The Messenger of Allah ﷺ said, "The earth has been made for me a place of prayer and a means of purification, so whenever the time of prayer comes upon any man of my nation, let him pray."
قال رسول الله ﷺ: جعلت لي الأرض مسجدا وطهورا، فأيما رجل من أمتي أدركته الصلاة فليصل.
Bukhari narrated it in the Book of Tayammum (335), and Muslim narrated it in the Book of Mosques (521), both of them through the route of Hushaym, from Sayyar, from Yazid Faqir, from Jabir bin Abdullah. He then mentioned the hadith.