* Answer taken en.islamtoday.net, here.
The first is the one adopted by the four Imams who ruled it as impermissible. They argued that the Prophet (peace be upon him) ordered women in menses to stand apart at the prayer area during the `Id prayer. [Sahîh al-Bukhârî (351) and Sahîh Muslim (890)]
The answer to this argument is that the order is meant for them to stand apart from the prayer itself as is clearly stated in in the narration in Sahîh Muslim “Let them stand away from the prayer.”
As for the hadîth related by Abû Dâwûd (232): “I do not permit a woman in her menses or a person in a state of major ritual impurity into the mosque” It is a weak hadîth. Its line of transmission contains a narrator who is unknown.
They also cite as evidence the ruling that a women is prohibited from tawâf around the Ka`bah. It is mentioned in the hadîth where the Prophet (peace be upon him) addressed `Aishah by saying: “Do as the pilgrims do but do not perform tawâf around the House until you become pure.” [Sahîh al-Bukhârî (305) and Sahîh Muslim (1211)]
However, it appears that this is a prohibition from tawâf itself and is not referring to entering the mosque. Indeed, it could well be argued that this hadîth provides us with good evidence that it is permitted for a menstruating woman to enter the mosque, because it does not say that she could not enter it.
The second saying is that it is permissible for the woman to stay in the mosque while she is in her menses. This is according to the school of thought of al-Zâhiriyyah as well as the opinion of the Shâfi`î jurist al-Muzanî. This view was also adopted by some later researchers and scholars.
They argue that since the basic ruling is that it is permissible for women to enter the mosque, therefore any claim that they are prevented from doing so needs to be substantiated by evidence.
They also argue that when Abû Hurayrah avoided the Prophet’s company because he was in a state of major ritual impurity, the Prophet (peace be upon him) said to him: “Glory to Allah, the Believer would not become impure” [Sahîh al-Bukhârî (283) and Sahîh Muslim (371)]
They also argue that it is allowed for unbelievers to enter the mosque and stay in it.
This is clear from the story of Thumâmah b. Athâl when he was tied to a column in the mosque. [Sahîh al-Bukhârî (469)]
Therefore, if it is argued that the menstruating woman is prohibited from entering the mosque because of abstract impurity, then it is countered by the fact that an unbeliever is permitted to enter the mosque.
If, on the other hand, it is argued that the prohibition of a menstruating woman from staying within the mosque is because of the problem of physical impurity, then this is countered by the fact that it is permissible for a woman who is suffering from continuous vaginal bleeding to enter the mosque.
This is according to the hadîth of `Aishah where she said: “One of the Prophets’s wives joined him in i`tikâf and she used to see blood and yellow spots. She had a bowl under here and would pray.” [Sahîh al-Bukhârî (310)]
Children were also allowed to enter the mosque, as is established in many authentic hadîth, while they do not care much to avoid physical impurities.
It is also authentically established that dogs used to walk through the mosque and urinate in it at the time of the Prophet (peace be upon him), and they never used to splash any water over that. [Sahîh al-Bukhârî (174)]
These are strong, mutually supporting points of evidence that strengthen the basic ruling of the permissibility of a menstruating woman staying in the mosque, and it can be adopted when necessary.
And Allah knows best.