Woman should be protected and concealed from men as much as her guardian can do that. The Messenger (peace and blessings of Allaah be upon him) preferred for women to pray in their houses and said that their reward for doing so is greater than their reward for praying in the mosque.
It was narrated from ‘Abd-Allaah ibn Mas’ood that the Prophet (peace and blessings of Allaah be upon him) said: “A woman’s prayer in her room is better than her prayer in her courtyard, and her prayer in her cabinet is better than her prayer in her room.” (Narrated by Abu Dawood, 570; al-Tirmidhi, 1173. This hadeeth was classed as saheeh by al-Albaani in Saheeh al-Targheeb wa’l-Tarheeb, 1/136).
“Her room” refers to a woman’s own room in the house, and “her courtyard” refers to the central area (in a traditional Arabic house), off which all the rooms of the house open.
A cabinet is like a small room inside the large room, in which personal items are stored.
(Commentary from ‘Awn al-Ma’bood).
It was narrated that Umm Humayd the wife of Abu Humayd al-Saa’idi came to the Prophet (peace and blessings of Allaah be upon him) and said, “O Messenger of Allaah, I like to pray with you.” He said, “I know that you like to pray with me, but your prayer in your room is better for you than your prayer in your courtyard and your prayer in your courtyard is better for you than your praying in your house, and your prayer in your house is better for you than your prayer in the mosque of your people, and your prayer in the mosque of your people is better for you than your prayer in my mosque.” So she issued orders that a prayer-place be prepared for her in the furthest and darkest part of her house, and she used to pray there until she met Allaah (i.e., died).”
(Narrated by Ahmad, 26550).
This hadeeth was classed as saheeh by Ibn Khuzaymah in his Saheeh, 3/95; Ibn Maajah, 5/595; al-Albaani in Saheeh al-Targheeb wa’l-Tarheeb, 1/135
It was narrated that ‘Aa’ishah (may Allaah be pleased with her) said: “If the Messenger of Allaah (peace and blessings of Allaah be upon him) had lived to see how women have started to behave, he would have prevented them [from going to the mosque] as the women of the Children of Israel were prevented.” I said, to ‘Umrah, “Were they prevented?” He said, “Yes.”
(al-Bukhaari, 831; Muslim, 445)
‘Abd al-‘Azeem Abaadi said:
The reason why their praying in their homes is better is because it is safer from fitnah or temptation. This was later borne out by the way in which women began to make a wanton display of their adornments, hence ‘Aa’ishah said what she said. (‘Awn al-Ma’bood, 2/193).
Hence women should be careful when praying in public places, or go far away from where men can see them, and should not pray in a public place when the time of prayer comes, unless she has no other place in which to pray.
Shaykh ‘Abd-Allaah al-Jibreen said:
With regard to women, their houses are better for them. If they need to pray in the marketplace and there is a place that is screened off, there is nothing wrong with them praying there, in sha Allah.
Fataawa al-Mar’ah al-Muslimah, 1/333
But what some of the common people say, that a woman’s prayer is invalidated just because a man happens to see her, has no basis in sharee’ah at all. The women used to pray at the time of the Prophet (peace and blessings of Allaah be upon him) in one mosque and he (peace and blessings of Allaah be upon him) did not rule their prayer to be invalid.
And Allaah knows best.