Abu Saeed Khudri reported,

While the Messenger of Allah ﷺ was leading his companions in prayer, he removed his sandals and placed them on his left side. When the people saw this, they too took off their sandals.When the Messenger of Allah ﷺ finished the prayer, he asked, "What made you take 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," or he said, "something offensive on them. So when one of you comes to the mosque, let him examine his sandals. If he finds any filth or offensive matter on them, let him wipe it off and pray in them."

Azami 2573

Sahih

عن أبي سعيد الخدري قال

بينما رسول الله ﷺ يصلي بأصحابه إذ خلع نعليه، فوضعهما عن يساره، فلما رأى ذلك القوم ألقوا نعالهم، فلما قضى رسول الله ﷺ صلاته قال: ما حملكم على إلقاء نعالكم؟ قالوا: رأيناك ألقيت نعليك فألقينا نعالنا. فقال رسول الله ﷺ: إن جبريل عليه السلام أتاني، فأخبرني أن فيها قذرا أو قال: أذى وقال: إذا جاء أحدكم إلى المسجد فلينظر، فإن رأى في نعليه قذرا، أو أذى فليمسحه وليصل فيهما.

الأعظمي 2573صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Prayer
Chapter
What one may pray in
Section
Prayer in sandals
Numbering
Jami al-Kamil 2573 (2nd edition)
Azami 2573