There are several reasons you could be experiencing shoulder pain from golfing or playing a sport in general. This can only be diagnosed by a professional. Although typically, when someone is dealing with shoulder pain from playing golf it is due
to a rotator cuff injury. A rotator cuff injury often occurs when a golfer is teeing off or hitting a long drive. So, It is very important to have good posture and to not overuse your joints while golfing.
Read this article on Tips on How to Prevent a Golf Injury.