Praise be to Allah.
Praying in shoes is something that is permitted, rather the Prophet (peace and blessings of Allaah be upon him) enjoined it so as to be different from the Jews. The Prophet (peace and blessings of Allaah be upon him) and his companions used to pray in their shoes, and the Prophet (peace and blessings of Allaah be upon him) told them that they should examine them lest there be any dirt on them. The Prophet (peace and blessings of Allaah be upon him) took off his shoes whilst praying on one occasion because Jibreel told him that there was some dirt on them, and the Sahaabah also took off their shoes. All of these ahaadeeth are saheeh, and they will be quoted and their isnaads will be discussed below, in a fatwa from the Standing Committee.
There is no doubt that their mosques were not furnished with carpets, rather the floors were of sand and pebbles, so it did not matter if they entered the mosque wearing shoes. But the mosques nowadays are furnished with carpets and entering them with shoes may lead to introducing dirt into the mosque. Some people are heedless and enter the mosque wearing shoes with dirt or impure substances on them.
If every worshipper were allowed to pray in the mosque wearing shoes, we would need dozens of workers to clean the mosque after every prayer, not just every day. We do not think that anyone who accepts this would like to pray on a carpet that is full of dust and dirt, let alone other unclean and impure substances, if people are negligent.
The scholars of the Standing Committee were asked:
There is a dispute about the ruling on entering the mosque in shoes and praying in shoes. What is the Islamic ruling on that?
The Prophet (peace and blessings of Allaah be upon him) entered the mosque in shoes and prayed in shoes. Abu Dawood narrated in his Sunan with his isnaad that Abu Sa’eed al-Khudri said: Whilst the Prophet (peace and blessings of Allaah be upon him) was leading his companions in prayer, he took off his shoes and placed them to his left. When the people saw that, they took off their shoes. When the Messenger of Allaah had finished the prayer he said, “What made you take off your shoes?” They said, “We saw you take off your shoes, so we took off our shoes.” The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Jibreel (peace be upon him) came to me and told me that there was some dirt on them.” And he said: “When one of you comes to the mosque, let him check his shoes, and if he seeds any dirt on them, let him wipe them and pray in them.”
Abu Dawood also narrated from Ya’la ibn Shaddaad ibn Aws that his father said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Be different from the Jews, for they do not pray in their shoes or their khufoof (leather slippers).”
And Abu Dawood narrated from ‘Amr ibn Shu’ayb, from his father, that his grandfather said: I saw the Messenger of Allaah (peace and blessings of Allaah be upon him) praying both barefoot and wearing shoes. This was also narrated by Ibn Maajah.
But now that mosques are usually furnished with fine carpets, the one who enters the mosque should take off his shoes and be careful to keep the carpet clean and not annoy other worshippers because of dirt that may get onto the carpet from the soles of his shoes, even if it is taahir (pure).
Fataawa al-Lajnah al-Daa’imah, 6/213, 214
Shaykh Ibn Baaz (may Allaah have mercy on him) was asked: What is the ruling on praying in shoes?
The ruling is that it is mustahabb after checking to make sure they are clean, because the Prophet (peace and blessings of Allaah be upon him) used to pray in his shoes, and because the Prophet (peace and blessings of Allaah be upon him) said: “The Jews and Christians do not pray in their khufoof (leather socks) or shoes, so be different from them.” But if a person prays barefoot, that does not matter, because it is proven that the Prophet (peace and blessings of Allaah be upon him) also prayed barefoot sometimes.
If the mosque is furnished with carpets, it is better to take the shoes off, so as to avoid making the carpets dirty or putting other Muslims off the idea of prostrating on it. End quote.
Majmoo’ Fataawa Ibn Baaz.
Shaykh al-Albaani (may Allaah have mercy on him) said: I have advised our Salafi brothers not to be so strict concerning this issue – i.e., praying in shoes in the mosques – because there is a difference between the mosques nowadays which are furnished with fine carpets, and the Prophet’s Mosque in the early days of Islam. I gave them the analogy of another example from the Sunnah, where in another story the Prophet (peace and blessings of Allaah be upon him) ordered the one who needed to spit whilst praying to spit to his left or beneath his feet. This was acceptable because the floor in the mosque where the person had to spit was made of sand or pebbles. But nowadays the prayer-hall of the mosque is furnished with carpets, so do they say that it is permissible to spit on the carpets?! Both cases are the same. End quote.
What Shaykh al-Albaani (may Allaah have mercy on him) had previously been said by Imam Ahmad (may Allaah have mercy on him).
Ibn Rajab (may Allaah have mercy on him) narrated in Fath al-Baari that Bakr ibn Muhammad said: I said to Abu ‘Abd-Allaah (i.e., Imam Ahmad ibn Hanbal): What do you think about a man spitting in the mosque then rubbing it with his foot? He said: The hadeeth refers to a different situation. He said: The mosques now have mats spread on the ground and they are not as they used to be. If he wants to spit whilst he is praying, then he may spit to his left, if the spittle will fall outside the mosque. If he is inside the mosque and he cannot make his spittle land outside the mosque, then he should spit into his garment. End quote.
So he stated that one should only spit in the mosque and rub it with one's foot if the mosque is not carpeted.
If it is difficult to take off one's shoes, as in the case of boots worn by the military, then they may pray in their shoes, subject to the condition that they ensure that they are clean.
The scholars of the Standing Committee were asked:
What is the ruling on entering the mosque with shoes, especially since the military are required by their work to wear their boots all the time, but the mosques are carpeted?
It is permissible to enter the mosque wearing shoes and to pray wearing them, if they are clean and pure, but they should be checked when entering the mosque to make sure there is no dirt on them. End quote.
Fataawa al-Lajnah al-Daa’imah, 6/215, 216
Based on this, it is better not to pray in the mosque wearing shoes nowadays, except for one for whom it is difficult to take off his shoes; he may pray in them after making sure that they are clean and that he will not annoy those who are next to him. If this will lead to some kind of argument and resentment, and will put others off, then it is better for him to take his shoes off, in the interests of harmony among Muslims and not causing enmity and hatred. The Muslim can perform the Sunnah and obey the Prophet (peace and blessings of Allaah be upon him) by praying in his shoes when that will not lead to any trouble, such as when praying in his house, or when praying on uncarpeted ground, and so on.