I've had that and agree with eric's assessment in regards to the type of injury. It happens from repeated exercise that puts stress on joints, ligaments and tendons. In this case the shoulder: rotator cuff, tendons and bursa. For certain people it's presses and shoulder-stressful exercises like laterals.
Basically you should lay off exercises that cause the pain, and if after you stop for a while the pain goes away, only go back to those exercises if you can find ways to avoid future problems. Higher reps and slight alterations in ROM and ROM speed can help, or the use of DBs instead of BB (more flexibily in ROM = less stress), machines, cables, etc. or just go with good alternative exercises and avoid those exercises altogether. I haven't done laterals for decades due to this.
Before getting to surgery, typically a cortisone shot can get rid of the pain incredibly well, make the shoulder good as new. However if you get rid of the pain and just go back to the same problem-causing exercises, the pain will probably return and be harder to cure in future. Bob Chic's a good example of a BB who hasn't done benches for ages due both to injury and the realization that other exercises can be more effective.