Praying behind or next to women in the Haram area
Response: If a man prayed behind the row of the women, then there is no harm in that as the jurists have stated, because the people are in need of doing so (when the need arises especially in the Haram area). However, if a woman prayed beside him and he feared the fitnah (of her praying beside him) then he should indicate (with his hand) she move away from him if he came and prayed there before she did. If, however, she came before him, then he should move to another place. And if a woman or women came and prayed beside him whilst he is praying, then he should indicate to them (with his hand) to move away from him.
Shaykh Ibn ‘Uthaymeen