Is it permissible for a person in a state of major impurity (Junub) to pass through the mosque?
Chapter on the Obligation of Purification
Al-Mughni
Book of Purification
Primary text
Passing through the mosque is permissible for a person in a state of major impurity if it is for a necessary reason, such as fetching or leaving an item, or if the mosque is the designated route. The evidence supporting this exception is the phrase "except as travelers (or passersby)" in the verse, where the exception from a prohibition implies permission. Support for permissible passage is drawn from the Prophet (peace be upon him) asking his wife Aisha, who was menstruating, to pass him an item from the mosque, stating that her menstruation was not in her hand (Hadith recorded by Muslim). Narrations from Jabir and Zayd ibn Aslam indicate that companions used to pass through the mosque while in a state of major impurity, suggesting a consensus among them.
Supporting text
Al-Thawri and Ishaq ruled that one should not pass through the mosque unless absolutely necessary, and in such a case, they must perform Tayammum first. This is supported by the general prohibition stated by the Prophet (peace be upon him): "I do not permit the mosque to a menstruating woman or one in a state of major impurity."