All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
Putting one leg over the other is permissible for a man or a woman, while sleeping or sitting. It is confirmed that 'Abbaad Ibn Tameem said: "I saw the Prophet in the mosque putting one leg over the other." [Al-Bukhari and Muslim] The prohibitions that have been reported about putting one leg over the other while lying on bed refers to when the 'Awrah (the parts of the body that must be covered in Islam) is revealed or a part of it. So if one puts his/her leg over the other while being secure from revealing his/her 'Awrah, that is permissible. As regards putting one leg over the other in front of elders, this depends on the customs of the people, if it is disliked in their customs then it would in good conduct to abandon it, but if this is something normal, then there is no harm. The same thing applies to a woman who sits in this manner in front of her Mahaarim (unmarriageable relatives).
Allaah knows best.