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, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
Scholars view that praying in the direction of one who is sleeping or sitting is disliked because his ‘Awrah may be exposed or a distraction may occur. Ad-Dusooqi Al-Maaliki said: “His saying 'such as the one who is sleeping' means that it is a distracting element for what may occur from him and this may confuse the one who is praying or exposing his ‘Awrah."
Praying in the direction of one who is sitting is also disliked if he is opposite to him. However, if he turns his back (towards the one praying), it has another explanation.
Ad-Dusooqi said: “In conclusion, praying in the direction of one who is opposite to the one who is praying is absolutely disliked. Praying in the direction of his back, if this person is a foreign woman, disbeliever or the like, is disliked. However, if this person is not a disbelieving man, it will be permissible without dislike. If the woman is a Mahram (i.e. prohibited consanguinity), then there are two opinions and the most preponderant of them is that of permissibility.”