The author - may Allah shower blessings on him- brought this chapter in order to explain that the mosque must be kept clean from all sorts of impurities, filths, phlegm, spittle, and their likes.
Then he mentioned the hadeeth of Anas and Aishah (may Allah be pleased with both).
The hadeeth of Anas (may Allah be pleased with him) stated that the Messenger of Allah ﷺ said: "Spitting in the mosque is a sin, and its expiation is that the spittle should be buried in earth." That is, if a person does that, he should bury it. In his statement ﷺ: 'Spitting in the mosque is a sin' is evidence for the prohibition of spitting in the mosque. The act of expelling one's snot, sputum or similar things in the mosque is a sin for two reasons:
The First Reason: It is harmful to those who are observing Salât. They may prostrate on it without knowing, and become irritated after seeing it. This would make anyone feel revolted.
The Second Reason: It is a degradation of the House of Allah – the Mighty and Sublime. He has ordered that His House be revered and that His name be glorified all day long. It is not permissible for anyone to spit in the mosque; but if he does, its expiation is to bury it if it is on the ground and to scrape it off if it is on the wall. This is based on the hadeeth of Aishah (may Allah be pleased with her) that the Prophet ﷺ saw a spittle or snot or sputum sticking to the wall of the mosque and he scratched it off. Based on this, the expiation for spitting if it is on the ground is to bury it, and if it is on the wall, is to scrape it until it disappears (from the surface).
However, as you can see, our mosques are floored today; hence, the expiation, in this case, is to wipe it with a piece of cloth until it vanishes. We have previously stated that it is not permissible for you to spit in the mosque but this is its expiation if it happens. This shows that when a person sees a filth or impurity in the mosque,
he should remove it.
As for the hadeeth of Anas (may Allah be pleased with him), it is about the incident of a Bedouin who came to the mosque and urinated in one of its corners. This is due to his ignorance for the majority of the nomads do not know anything. People began to scream at him but the Prophet ﷺ forbade them from that. When he finished urinating, the Prophet ﷺ said to the companions, "Pour a bucket of water on his urine". Then he ﷺ called the Bedouin and said to him, "It is not proper to use the mosque for urinating or easing oneself. They are merely built for Salat, the recitation of the Qur'an and for the remembrance of Allah." The Prophet ﷺ explained that the mosques are not for filth and impurity.
Therefore, a Muslim should respect the House of Allah and should not throw dirty and filthy things inside it. He should not raise his voice in it; he should behave well for the mosques are the Houses of Allah and the habitation of the angels.
Allah alone grants success.