Sheikh `Abdul-Majeed Subh, a prominent Azharite scholar, states: “As far as Islamic Shari`ah is concerned, there is nothing wrong if a woman is praying nafl or fard in the front part of a room and while she is praying one of her mahrams such as a husband of father enters the room to pray fard or nafl behind her without having her as an imam. As he is one of her mahrams, there is nothing wrong in standing to do his Prayer behind her.

As for the second case when the man is non-mahram, she has two options:

a) From the very beginning, if she expects a non-mahram to enter the same room, she should lock the door with the key in order not to let a non-mahram enters while she is offering the Prayer.

b) The second option is to make her back opposite to the wall in order not to allow anybody to stay behind her or to see her from the back.

If while she is offering Prayer a non-Mahram enters the room, she can move to let her back opposite to a wall. But in the future insha’ Allah she should take care of this issue. As the one entering the room is a Muslim, she should teach him kindly and wisely that he should seek permission by knocking on the door before entering and in case he finds a woman offering Prayer, he should not pray behind her. The non-mahram person who enters the room is required to lower his gaze.