Why do Muslims remove their shoes for prayer?
Like so many issues in Islam the issue of taking off shoes at prayer or, rather, of whether it is allowed to leave one’s shoes on while praying, is an issue of purity, cleanness. The commandment to keep one’s body and mind clean has been given us by the Almighty Allah. Anything conducive to the fulfilment of this commandment must be accepted and effected, and anything conducive to the violation of this commandment is to be shunned and banned.
Allah the Almighty and His Messenger Prophet Muhammad are first and foremost observant of preserving cleanness in the widest sense of the word.
This can be the avoidance of dirt prohibited by Allah (najis, i.e. impurities) But even if none of that has stuck to the soles of your shoes, this can be ordinary street dirt, ‘household’ filth, so to speak, which shall simply soil the carpets and shall make them look improperly thus disrupting God’s decorum and comeliness which Allah has ordered man to preserve at all times.
If we were to be sure that not one small particle of that filth shall remain on our shoes that tread everywhere, anywhere it pleases, without looking or discerning, we could easily pray with the shoes on. The ban is not for shoes. The ban is for the filth. Prophet Muhammad himself prayed with his shoes on. “I asked Anas bin Malik whether the Prophet had ever, prayed with his shoes on. He replied ‘Yes.’” (Sahih al-Bukhari, 386)
The Prophet did not forbid his companions to pray with their shoes on, on one condition, though, that it must be cleansed of all filth.
“While the Messenger of Allah was leading his Companions in prayer, he took off his sandals and laid them on his left side; so when the people saw this, they removed their sandals. When the Messenger of Allah finished his prayer, he asked: What made you remove your sandals? The replied: We saw you remove your sandals, so we removed our sandals. The Messenger of Allah then said: Jibril came to me and informed me that there was filth in them. When any of you comes to the mosque, he should see; if he finds filth on his sandals, he should wipe it off and pray in them.” (Sunan Abu Dawood, 650)
Let’s suppose you must say your namaz outside. It does happen now and then and it is a normal occurrence. Street dirt is not construed as najis. So you are not required to take off your shoes due to religious considerations in such a situation. However, you do not have to keep them on for reasons of maintaining cleanness either. By taking your shoes off outside you will do quite the opposite to cleanness, you will soil your feet. Therefore, there is no direct connection between prayer and shoes. There is a direct connection between prayer and cleanliness. It is for the sake of maintaining cleanliness that the shoes must be removed when you cannot wipe off every bit of najis from them or when keeping them on makes the interior dirty.