It was narrated that Ibrahim said: "I used to recite Qur'an to my father on the road, and if I recited a verse in which prostration was required, he would prostrate. I said: “O my father, do you prostrate on the street?' He said: “I heard Abu Dharr say: "I asked the Messenger of Allah (ﷺ): “Which Masjid was built first?' He said: “Al-Masjid Al-Haram.' [1] I said: “Then which?' He said: “Al-Masjid Al-Aqsa.' [2] I said: “How long was there between them?' He said: “Forty years. And the earth is a Masjid (or a place of prostration) for you, so wherever you are when the time for prayer comes, pray.'" [1] In Makkah. [2] "Furthest Masjid", meaning the Masjid in Jerulsalem””””””””"
SahihSahihSahih - Agreed UponBook 8 · Hadith 3