Sayyidah Aishah (may Allah be pleased with her) said: When the Prophet (peace and blessings be upon him) came, the doors of the Companions' houses opened onto the mosque. He (peace and blessings be upon him) said: "Turn the doors of these houses away from the mosque." Then he (peace and blessings be upon him) went into the house, and the people did not change the doors of their houses, hoping that he (peace and blessings be upon him) might grant them a concession. Then he (peace and blessings be upon him) came out to them and said: "Turn the doors of these houses away from the mosque, for I do not make the mosque lawful for a menstruating woman or for one in a state of major impurity (junub)."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4323
Musa bin Isma'il added to it, from Abd al-Wahid: "Except for Muhammad (peace and blessings be upon him) and the family of Muhammad." Al-Bukhari said: Jasrah has strange reports.
Al-Bukhari said: Urwah and Abbad bin Abdullah narrated from Sayyidah Aishah (may Allah be pleased with her) that the Prophet (peace and blessings be upon him) said: "Close all the other doors except the door of Abu Bakr (may Allah be pleased with him)." And this is more authentic.
The Shaykh said: If this (previous report) is authentic, then with regard to the person in a state of major impurity (junub) it is understood to refer to staying in the mosque, not passing through it, on the evidence of the Book.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4324
Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both), commenting on the saying of Allah Almighty: "Nor when in a state of major impurity, except when passing through, until you have bathed" [Surah al-Nisa: 43], said: A person in a state of major impurity should also not approach the prayer until he has performed the ritual bath (ghusl), except a traveller, who may. He said: Do not enter the mosque while in a state of major impurity, unless your way passes through it; but do not sit down.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4325
Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) used to permit a person in a state of major impurity to pass through the mosque, and he would say concerning "Nor when in a state of major impurity, except when passing through" [Surah al-Nisa: 43]: What I know is that a person in a state of major impurity should not approach the prayer, except a traveller.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4327
Sayyiduna Anas bin Malik (may Allah be pleased with him), commenting on the saying of Allah Almighty: "Nor when in a state of major impurity, except when passing through" [Surah al-Nisa: 43], said: A person in a state of major impurity should not approach the prayer, except a traveller; he may pass through, but it is not proper for him to sit.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4328
Abu Amr (may Allah have mercy on him) narrated that he heard Ata' (may Allah have mercy on him) say: A menstruating woman and a woman in a state of major impurity do not undo their plaited hair or their braids, and a menstruating woman may pass through the mosque in case of necessity.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4329