The Ruling on Praying while a Person is wearing His Shoes
Question :
The brother who signs his name as S.S.S. asks about prayer performed by a person wearing shoes, and he says that they harm the other worshippers, especially since in these times, the mosques are furnished with the best of carpets. Yet some people say that in doing so, they are reviving the Sunnah of the Messenger of Allah, and he requests an explanation of the Islamic ruling on this.
Answer:
The answer to this question requires a detailed explanation: If the shoes are safe and clean and there is nothing in them to harm the other worshippers or the carpets, then there is no sin in it and the prayer is correct, since it has been authentically reported from the Prophet that he prayed in his shoes one day, then he removed them because of some filth on them and the Companions, may Allah be pleased with them, removed theirs also; after the prayer, he said to them:
Why did you remove your shoes?»
They said: "We saw you removing your shoes, O Messenger of Allah, and so we removed ours."
He said:
«Verily, Jibril informed me that there was something harmful (in another narration: filth) on them, so I removed them. So if any of you comes to the mosque, he should look, and if he sees anything harmful (on them), he should wipe it and pray in them.
Thus it was reported from him. However, if there should be any dirt on them, or impurities or anything which will soil the carpet, such as mud or the like, one should not pray in them, nor enter the mosque in them. Instead, he should leave them at the door, so that he does not harm the mosque and those in it and so that their place of prayer does not become soiled, especially when there are carpets that are affected by everything. It is better for the believer in this situation to leave his shoes in some place and walk in the mosque without shoes, so as not to harm anyone with dust or anything else.
As for the Sunnah in this matter, it is revived by words and explanation that the Prophet did this and that there is no objection to it. But most of the people are careless and they do not take care of their shoes; indeed they enter the mosque without caring, therefore if it were permitted for them to enter the mosque in their shoes, dirt and harmful things would collect in the carpet and some people would refuse to pray in the mosque because of it, it would offend the worshippers, and they would be harmed by that which soiled them, and he (the worshipper) only came there with the intention of doing good and performing the Sunnah; and the Sunnah in this situation is not to harm the other worshippers and not to soil their mosque.
This is what is obligatory upon the believer, and there is no doubt that a carpet is affected by everything. This is what is best and what conforms to the Islamic law. As for mosques in which there are no carpets, if one prays wearing shoes, it is better, so long as they are clean and free from dirt.
Source:
Ibn Baz
Fatawa Islamiyah, Vol. 2 Pages 192-193-194