Read Dr. Timothy McCall’s response:
It is natural to lose some flexibility when you stop doing practices that build it. Most people lose flexibility anyway as they get older, and the layoff probably worsened that trend. It’s likely that the connective tissue, or fascia, that surrounds both muscles and individual muscle fibers has shortened, and now you must work to gently stretch it.
The key is patience and persistent practice. When you are at the point where the shoulders feel like they are about to lock up, you are probably pushing too hard, which is natural when you’re trying to do something you used to be able to do. Better to back off a bit, so that your breath and mind stay calm and relaxed, and only go deeper into the pose as your body invites it. People debate about how long you have to hold a pose to relax the fascia, but in general, longer holds of a minute or more are likely to be more effective than brief holds.
Clasping your hands behind your back requires strong internal rotation of your humerus (upper arm) bones. When you are unable to do this sufficiently, the top part of the humerus tends to jut forward in the shoulder joint, and that can be painful. One trick is to move your elbow forward as your hand moves across your back, like a shoulder pat, which tends to relieve the pressure in the shoulder joint. You can also practice one arm at a time, doing the lower-arm portion of Gomukhasana (Cow Face Pose) and using the other hand to gently encourage your hand and lower arm into position.