While weakness in any muscle can cause problems, commonly, the Serratus Anterior (the muscles that pulls the Scapula forward and is located on the front of the upper rib cage, in the arm pit) is weak.
In the picture of the woman (not my client, I wouldn't let this happen) performing a push-up, notice how her shoulder blades are 'shrugged' up towards her ears. Not good. In the down-position of the push-up, the shoulder blades should be pulled tight to the rib cage and not 'wing out'.
The improper alignment of the Scapula can lead to pain and degenerative changes In the shoulder joint, as tendons can become compressed (impingement).
The Serratus Anterior is one of the main muscles that pulls the Scapulae against the rib cage. Strengthening these muscles by focusing on retracting the Scapulae during the descent of the push-up and spreading them upon ascent will help improve your shoulder function. In fact, since this is such a common weakness, 'Scapular Push-Ups' are a regular warm-up/ corrective exercise for my clients.