Praise be to Allaah.
It is haraam for a menstruating woman to stay in the mosque,
because of the report narrated by al-Bukhaari (974) and Muslim (890) from
Umm ‘Atiyyah (may Allah be pleased with him) who said: He -- meaning the
Prophet (blessings and peace of Allah be upon him) -- commanded us to bring
out on the two Eids the girls who had attained puberty and those who were in
seclusion, but he told the menstruating women to keep away from the
prayer-place of the Muslims.
So the Prophet (blessings and peace of Allah be upon him)
forbade menstruating women to come to the Eid prayer place, and he told them
to keep away from it, because it comes under the same rulings as the mosque.
This indicates that a menstruating woman is not allowed to enter the mosque.
This is the view of the majority of scholars.
This has been discussed in the answers to questions number
There is no distinction between the mosque in which Jumu’ah
prayer is held and one in which it is not held, or between one which has a
minaret and one which does not. What matters is the fact that it is a
mosque, i.e., a place that is devoted for prayer.
With regard to prayer rooms in workplaces and schools, which
remain the property of the owner and are not established as mosques per se,
they do not come under the same rulings as mosques, so it is permissible for
a menstruating woman to enter them and stay in them.
The scholars of the Standing Committee for Issuing Fatwas
Does the prayer room in the university residence come under
the same rulings as a mosque with regard to praying tahiyyat al-masjid (two
sunnah rak’ahs performed upon entering to “greet the mosque”) and reciting
the adhkaar for entering and leaving the mosque?
Prayer rooms in university residences and elsewhere do not
come under the same rulings as mosques in every aspect. End quote.
Fataawa al-Lajnah al-Daa’imah
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) was asked
about prayer rooms in schools that are set up for Zuhr prayer only: is it
permissible for a menstruating woman to enter them?
Prayer rooms in schools do not come under the same rulings as
mosques. Rather they are prayer rooms. Not every place in which prayers are
held is regarded as a mosque. The mosque is that which is set up for prayer
in general and is built and prepared for that purpose. Simply taking a place
as a place in which to pray does not make it a mosque.
Based on that, it is permissible for a menstruating woman to
enter and stay in the prayer room of a school. End quote from Liqa’
al-Baab al-Maftooh, 22/27.
To sum up: it is not permissible for you to sit in the mosque
when you are menstruating, but it is permissible to do so in a prayer room
that does not come under the same rulings as a mosque.
And Allah knows best.