While the Messenger of Allah ﷺ was leading his companions in prayer, he took off his sandals and placed them on his left side. When the people saw this, they threw off their sandals as well. After the Messenger of Allah ﷺ finished his prayer, he asked, "What made you throw off your sandals?"They replied, "We saw you take off your sandals, so we took off ours."The Messenger of Allah ﷺ said, "Jibreel came to me and informed me that there was filth on them," or he said, "something harmful." He continued, "When one of you comes to the mosque, let him check his sandals. If he sees filth or something harmful on them, let him wipe it off and pray in them."
بينما رسول الله ﷺ يصلي بأصحابه، إذ خلع نعليه فوضعهما عن يساره، فلما رأى ذلك القوم، ألقوا نعالهم، فلما قضى رسول الله ﷺ صلاته قال: ما حملكم على إلقائكم نعالكم؟ قالو: رأيناك ألقيت نعليك فألقينا نعالنا، فقال رسول الله ﷺ: إن جبريل عليه السلام أتاني، فأخبرني أن فيهما قذرا- أو قال: أذى، وقال: إذا جاء أحدكم إلى المسجد فلينظر، فإن رأى في نعليه قذرا، أو أذى فليمسحه وليصل فيهما.
Abu Dawud (650) narrated it from Musa bin Ismail, who said, Hammad narrated to us, from Abu Naama Saadi, from Abu Nadra, from Abu Saeed Khudri, and he related it. Its chain of transmission is sahih. Hammad here is Ibn Zayd, as occurs in some copies, while in another copy it is Hammad bin Salama, and Bayhaqi (2/431) said the same after narrating it from Abu Dawud. Ibn Khuzayma also included it (1017) in his Sahih, as did Hakim (1/260), who said, "Sahih according to the criterion of Muslim." Nawawi said in Majmu (2/179), "Its chain of transmission is sahih." As for the claim that it is a mursal narration, Abu Hatim gave preference to the connected version, in Ilal (1/121).As for what is narrated from Abu Hurairah, "If one of you treads on filth with his sandal, then the earth is a purifier for it," this is daif. Abu Dawud narrated it (385), and it contains an unidentified teacher of Uzai. In another version, his teacher is said to be Ibn Ajlan, but the one who narrated from him, Muhammad bin Kathir Sanani, had poor memory. It is also narrated from Ayesha with the same meaning, but it contains Qaqa bin Hakeem, who did not hear from Ayesha. All these narrations are found in Abu Dawud.Hafiz said in Talkhis (1/278), Hakim also narrated it from the hadith of Anas and Ibn Masud, and Daraqutni narrated it from the hadith of Ibn Abbas and Abdullah bin Shikhir, and the chain of transmission of each of these is daif. Bazzar also narrated it from the hadith of Abu Hurairah, and its chain of transmission is daif and also defective.