Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) says: The Prophet (peace and blessings be upon him) took off his sandals while praying, so those behind him (peace and blessings be upon him) also took off their sandals. He (peace and blessings be upon him) said: "What made you take off your sandals?" They said: "We saw you (peace and blessings be upon him) take yours off, so we took ours off too." He (peace and blessings be upon him) said: "Jibril (peace be upon him) informed me that there was filth on one of them; that is why I took them off. Do not take off your sandals."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 9936