In our town there is a mosque where the women pray alongside the men, but they are separated by a wall. Is this action valid, or must the women pray behind the men?
Praise be to Allaah.
Firstly:If a woman prays alongside a man but there is a barrier between them, such as a wall, or a gap which is wide enough for a person to stand and pray there, then the prayer is valid according to the majority of scholars among the Hanafis, Maalikis, Shaafa’is and Hanbalis, but they differed with regard to a woman who prays beside a man with nothing separating them. The Hanafis are of the view that she invalidates the prayer of three men: one to her right, another to her left and a third behind her, subject to conditions that they mentioned.See al-Mabsoot
(1/183); Badaa’i’ al-Sanaa’i’
(1/239); Tabyeen al-Haqaa’iq
(1/136-139).Al-Nawawi (may Allaah have mercy on him) said, discussing the difference of opinion on this topic and summing up the Hanafi view: If a man prays and there is a woman beside him, that does not invalidate his prayer or hers, whether he is leading the prayer or praying behind an imam. This is our view and it was also the view of Maalik and the majority. Abu Haneefah said: If the woman is not praying or she is offering a different prayer than him and is not praying with him, his prayer and hers are both valid. If she is praying with him – and in Abu Haneefah’s view she cannot be praying with him unless the imam intended to lead the women in prayer too – then if she joins the prayer and stands beside a man, the prayer of the men who are standing on either side of her is invalidated, but her prayer and the prayer of the man who is beside the man who is beside her are not invalidated, because there is a barrier between her and him. If she is in the row in front of him, the prayer of those who are beside her and behind her are invalidated, but the prayer of those who are beside the ones who are beside her is not invalidated, because there is a barrier between them. If the women’s row is behind the imam and there is a row of men behind them, then the prayer of the row behind them is invalidated, but by analogy the prayer of the rows behind that row is not invalidated, because there is a barrier. But we say that the prayer of the rows of men behind them is invalidated, even if there are a hundred rows. If she stands beside the imam, then the prayer of the imam is invalidated, because she is next to him, and his view is that if the prayer of the imam is invalidated, the prayer of those who are praying behind him is also invalidated, and her prayer is also invalidated, because she is one of those who are praying behind him.
This view is based on weak evidence and this argument has no basis. Our view is that the prayer is valid unless there is sound shar’i evidence to prove that it is invalid, and they do not have such proof. Our companions drew an analogy from her standing in the funeral prayer, which is not invalidated in their view. Allaah knows best which is correct, and to Him be all praise. He is the Source of strength, guidance and protection. End quote from al-Majmoo’(3/331).
But if there is a barrier, the Hanafis agree with the majority that it does not invalidate the prayer of either of them, as it says in Tabyeen al-Haqaa’iq(1/138)
Undoubtedly the Sunnah is for the women’s rows to be behind the men, as was the case at the time of the Prophet (peace and blessings of Allaah be upon him). Al-Bukhaari (380) and Muslim (658) narrated from Anas ibn Maalik (may Allaah be pleased with him) that his grandmother Mulaykah invited the Messenger of Allaah (peace and blessings of Allaah be upon him) to a meal that she had made for him, and he ate some, then he said: “Get up and let me lead you in prayer.” Anas said: I went and got a reed mat of ours that had become blackened from long use, and sprinkled it with water. Then the Messenger of Allaah (peace and blessings of Allaah be upon him) stood, and the orphan and I stood behind him, and the old lady stood behind us, and the Messenger of Allaah (peace and blessings of Allaah be upon him) led us in praying two rak'ahs, then he left.
Al-Haafiz said in al-Fath: This hadeeth teaches us a number of things… that women should stand behind the men’s rows, and a woman should form a row on her own if no other woman is present. End quote.
But if what you describe happens, and a woman is praying alongside men, the prayer is valid, praise be to Allaah.
And Allaah knows best.