Praise be to Allah.
Menstruating women are not forbidden to enter Makkah or Madeenah. There is nothing in the texts to suggest that they are not allowed to enter these cities. Rather the texts indicate the opposite. The women who come for Hajj and ‘Umrah can be menstruating and the only thing that they are not allowed to do is to circumambulate the Ka’bah. ‘Aa’ishah (may Allaah be pleased with her) was with the Prophet (peace and blessings of Allaah be upon him) during the Farewell Pilgrimage and she got her menses before she entered Makkah, but he (peace and blessings of Allaah be upon him) did not tell her not to enter the city until she became pure (her period ended)! Rather he told her to do all the rituals of Hajj except for Tawaaf around the Ka’bah, which she was to delay until she became pure. He (peace and blessings of Allaah be upon him) said: “Do everything that the pilgrims do, but do not circumambulate the House until you become pure.” Narrated by al-Bukhaari, 305; Muslim, 1211.
Don’t the women who live in Madeenah also menstruate? Do they go out of the city at that time? The point is that there is nothing wrong with a menstruating women entering Makkah or Madeenah and staying there. It is very clear and there is no need to look for evidence.
With regard to a menstruating woman entering the mosque (whether it is al-Masjid al-Haraam in Makkah, or the Mosque of the Prophet (peace and blessings of Allaah be upon him) in Madeenah, or any other mosque, we have explained in the answer to question no. 33649 that it is not permissible for a menstruating woman to enter the mosque.
And Allaah knows best.