Sunan an-Nasa'i 690
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.
أَخْبَرَنَا عَلِيُّ بْنُ حُجْرٍ، قَالَ حَدَّثَنَا عَلِيُّ بْنُ مُسْهِرٍ، عَنِ الأَعْمَشِ، عَنْ إِبْرَاهِيمَ، قَالَ كُنْتُ أَقْرَأُ عَلَى أَبِي الْقُرْآنَ فِي السِّكَّةِ فَإِذَا قَرَأْتُ السَّجْدَةَ سَجَدَ فَقُلْتُ يَا أَبَتِ أَتَسْجُدُ فِي الطَّرِيقِ فَقَالَ إِنِّي سَمِعْتُ أَبَا ذَرٍّ يَقُولُ سَأَلْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم أَىُّ مَسْجِدٍ وُضِعَ أَوَّلاً قَالَ ‏"‏ الْمَسْجِدُ الْحَرَامُ ‏"‏ ‏.‏ قُلْتُ ثُمَّ أَىُّ قَالَ ‏"‏ الْمَسْجِدُ الأَقْصَى ‏"‏ ‏.‏ قُلْتُ وَكَمْ بَيْنَهُمَا قَالَ ‏"‏ أَرْبَعُونَ عَامًا وَالأَرْضُ لَكَ مَسْجِدٌ فَحَيْثُمَا أَدْرَكْتَ الصَّلاَةَ فَصَلِّ ‏"‏ ‏.‏