I have a question. What is the ruling of praying while wearing shoes? Especially for us who are flood aid volunteers where we have to wear shoes wherever we are due to the condition of the road and place we are at. So, sometimes we’ll just pray in some empty spaces or an empty and clean plot of land. Hope for your explanation.
Alhamdulillah, praise and gratitude to Allah SWT for His countless blessings for us all. Praise and salutations to our beloved Prophet Muhammad PBUH, his family, companions, and all those who follow his footsteps until the Final day.
We begin with the statement of Allah SWT:
فَاتَّقُوا اللَّهَ مَا اسْتَطَعْتُمْ وَاسْمَعُوا وَأَطِيعُوا وَأَنفِقُوا خَيْرًا لِّأَنفُسِكُمْ ۗ وَمَن يُوقَ شُحَّ نَفْسِهِ فَأُولَٰئِكَ هُمُ الْمُفْلِحُونَ
“So, fear Allah as much as you are able and listen and obey and spend [in the way of Allah]; it is better for your selves. And whoever is protected from the stinginess of his soul – it is those who will be successful.” 
Al-Sa’di stated in his commentary, Taisir al-Karim al-Rahman fi Tafsir Kalam al-Mannan , Allah SWT commanded His slaves to have taqwa and leave all of His prohibitions. This verse shows that any obligation that a slave isn’t capable to do is abrogated for him. Likewise, if a slave can fulfil some of the obligations or isn’t capable to perform some of the obligations, then he should perform the obligation according to his capability and the rest of which he isn’t capable is abrogated from him as stated by the Prophet PBUH:
وَإِذَا أَمَرْتُكُمْ بِأَمْرٍ فَأْتُوا مِنْهُ مَا اسْتَطَعْتُمْ
“And if I order you to do something, then do of it as much as you can.” 
Definition of Shoes
According to the 4th Edition of Kamus Dewan, shoes is defined as foot gear such as slippers, shoes, and others.  In other words, shoes are footgear that acts to protect one’s feet. Shoes have a sole base and heel. Most shoes have a slightly elevated upper part from the ankles. People wear shoes to protect their feet from the cold weather, sharp objects and uncomfortable surfaces. Shoes are also an important part of human clothing. Thus, fashion will usually determine the style of shoes a person wears. Most shoes are made from leather. However, there are numerous types of materials used such as canvas, velvet and synthetic materials such as plastic. The material and style of a shoe are varied depending on the weather, custom and other differences. (See World Encyclopaedia, transl. DBP, 10/332)
Praying While Wearing Shoes
In a hadith from Syaddad bin Aus RA, the Prophet PBUH said:
خَالِفُوا الْيَهُودَ فَإِنَّهُمْ لاَ يُصَلُّونَ فِي نِعَالِهِمْ ، وَلاَ خِفَافِهِمْ
“Act differently from the Jews, for they do not pray in their sandals or their shoes.”* * Khuff (pl. khifaf), an article of footwear which came up above the ankle.” 
Al-Munawi stated that (because) the Jews didn’t wear shoes or slippers, then you should pray while wearing your shoes if they are clean and does not have najis (to contradict the Jews). Some salaf scholars took the literal meaning and said: “Whoever’s shoes came into contact with najis and walked through soil or land, then it is pure and permissible to wear it in prayer.” This is the qadim opinion for Imam al-Syafi’i, while his jadid contradicts this. 
There is a narration from Abu Maslamah Sa’id bin Yazid al-Azdi, where he asked Anas bin Malik:
أَكَانَ النَّبِيُّ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ يُصَلِّي فِي نَعْلَيْهِ؟ قَالَ: نَعَمْ.
“’Did the Prophet (ﷺ) pray in sandals?’ He said: ‘Yes.'” 
Badruddin al-‘Aini cited from Ibn Battal that according to hadith scholars, this hadith means that if there isn’t najis on both slippers (or shoes), then it is permissible to pray while wearing them. If there is najis on the shoes, then he should wipe them – clean them by removing the najis first – then he can pray while wearing the shoes.
However, they differed as to the methodology of cleaning the najis on the shoes. Some scholars are of the opinion that if the shoes come in contact with a wet najis, then it is enough to just wipe it clean on the soil, then pray while wearing it. According to Imam Malik and Abu Hanifah, wet najis should be washed with water, while for dry najis, it is sufficient to just wipe or brush it over (without using water). As for Imam al-Syafi’i, in his opinion, najis on shoes, slippers khuf or others can only be cleaned with water.
Furthermore, al-‘Aini also cited from Ibn Daqiq al-‘Id that praying while wearing slippers is included in rukhsah matters and not sunnah for the action is not included in the meaning required of prayer. Then, al-‘Aini criticizes the statement which states that the act (praying while wearing slippers, shoes and others) is considered as sunnah and encouraged from the intention angle to contradict the action of the Jews and it is not included as sunnah matters (in prayer) for praying while wearing shoes is not the meaning as evident. 
Thus, we are permitted to pray while wearing shoes, slippers and others on the condition that the shoes or slippers are clean and pure from najis. If there is najis, then we should first clean it, then we can pray while wearing it. This is as stated in another hadith of the Prophet PBUH:
إِذَا جَاءَ أَحَدُكُمْ إِلَى الْمَسْجِدِ فَلْيَنْظُرْ فَإِنْ رَأَى فِي نَعْلَيْهِ قَذَرًا أَوْ أَذًى فَلْيَمْسَحْهُ وَلْيُصَلِّ فِيهِمَا
“When any of you comes to the mosque he should look and if he sees impurity on his sandals (shoes) he should wipe them and then pray in them.” 
According to the above discussion, in our opinion, praying while wearing shoes, slippers or others is valid and follows the syarak instruction to differ from the Jews. However, one must first ensure that the shoes and slippers worn are clean and pure from najis. The same applies to a place or space that one wishes to pray at, it must be clean from any najis for it is included as the valid conditions of prayer which is the body, clothing and place of prayer must be clean from any najis.
However, the situation is different if one wishes to pray while wearing shoes in a mosque considering the uruf and custom in Malaysia. Thus, not wearing shoes or slippers in a mosque to pray is the norm and even in our own house, we’d take off our shoes upon entering. This is the aula and is prioritized from wearing shoes and entering the mosque and praying with it.
May Allah SWT give us a clear understanding in religion. Ameen
 See https://prpm.dbp.gov.my/cari1?keyword=kasut. Accessed on 23rd December 2021.