Abū Ḥanīfah and Sufyān said, “He must not pass through the mosque; if he is compelled to do so, he should perform tayammum (dry ablution) and then proceed.” Those who prohibited entry supported their stance with a ḥadith …
I say: He went on to cite the reports of ʿĀʾishah, Umm Salamah, and al-Muṭṭalib ibn ʿAbd Allāh mentioned earlier, and then remarked, “All of this is unsound.” He outlined their defects as he had done before, and then quoted what al-Bukhārī transmitted with his chain from ʿĀʾishah, Mother of the Believers: that a black slave-girl had belonged to an Arab clan who later set her free; she came to the Messenger of Allah ﷺ, embraced Islam, and used to keep a small tent—or hut—in the mosque.
Ibn Ḥazm commented: “Here is a woman residing in the Prophet’s ﷺ mosque, and it is well known that women menstruate, yet he ﷺ neither prevented her from doing so nor forbade it. Whatever he ﷺ did not forbid is lawful.” He added, “Had it been impermissible for a menstruating woman to enter the mosque, the Prophet ﷺ would have informed ʿĀʾishah when she menstruated; yet he only forbade her from performing tawāf (circumambulation of the Kaʿbah). It is certainly false to claim that entry to the mosque was unlawful for her while the Prophet ﷺ refrained from prohibiting it and limited himself to preventing tawāf. This is also the position of al-Muzanī, Dāwūd, and others.”
Al-Qurṭubī, in his Tafsīr, writes: “A group granted license for a person in major ritual impurity to enter the mosque, and some of them cited the Prophet’s …”