There is nothing wrong with performing prayer while wearing one’s shoes as long as the shoes are completely pure. Hence, the purity of the shoes is a precondition for performing prayer in this case.
Dr. Muzzamil Siddiqi, former president of the Islamic Society of North America (ISNA), states the following: “It is permissible to pray with the shoes on, if they are clean. There are many Prophetic Hadiths on this subject. Sa`id Ibn Yazid Al-Azdi (may Allah be pleased with him) said: I asked Anas Ibn Malik (may Allah be pleased with him) whether the Prophet (peace and blessings be upon him) had ever prayed with his shoes on. He replied “Yes.”
Having stated the above, I add that it is better to take shoes off when praying inside a Mosque because Mosques have to be kept very clean as many people come to pray and sit there. However, praying outside the Mosque one has a choice either to keep one’s shoes on if they are clean or to take them off. However, if there is doubt over the cleanliness of one’s shoes, then one must take them off for prayer.”
Focusing more on the condition that allows one to pray while wearing shoes, we would like to cite for you the following: “The only condition which allows one to pray with shoes on is that the shoes that one wears should not be tainted with impurity. This means that if one is certain that one has not stepped over an impurity, one may offer one’s prayers wearing one’s shoes.
The other point of importance is that when one wants to do this in a Mosque, one has to make sure that one does not bring any dirt into the Mosque because Mosques have to be kept clean.”