Getting your legs behind your head is one of those yoga movements that seems more fit for contortionists than the average yogi.
If you can learn how the movement is happening in your hips, you find the freedom to tie your body up like a pretzel and release stores of energy in your pelvis.
Three key elements are present in every leg-behind-the-head posture: (1) Your hips externally rotate to create the space to move your thigh bone far enough back to place it behind your head. (2) Your pelvic floor and core strength must be strong enough to support your back, neck and legs in the posture. (3), Your lower back needs to widen and round slightly to facilitate the full rotation of the hip joint.
If your back or hips are too tight, then your legs will not go behind your head. If your core strength, shoulders and torso are not strong enough, then your legs will not feel good behind your head. You will need a careful balance between strength and flexibility to fully do this movement. Placing both legs behind your head requires an even more advanced level of strength and flexibility.
When you’re working with external rotation of your hips, it's important not to force the joint into movement. Instead of fighting with your body, simply engage the core and relax the hips to create spaciousness deep within the pelvis.
If the muscles around your hips are tight, fighting with them will only make them tighter. In fact, if you pull too hard on your legs when trying to get them behind your head, you risk injuring your knees if the hips are not fully externally rotated. Instead of forcing your body into postures before your body is ready, spend time learning the key anatomical alignment needed to enter the posture safely.
With placing your legs behind your head, work on relaxation as the starting point of the posture, and over time your body will open.