Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
ahmad:21468Muḥammad b. Jaʿfar > Shuʿbah > Sulaymān > Ibrāhīm al-Taymī from his father > Abū Dhar

[Machine] The Prophet ﷺ was asked about the first mosque that was built for the people. He said, "The Sacred Mosque (in Mecca) and then the Al-Aqsa Mosque (in Jerusalem)." He was asked, "How many years between them?" He said, "Forty years. And wherever the prayer time reaches you, pray there. And then there will be another mosque."  

أحمد:٢١٤٦٨حَدَّثَنَا مُحَمَّدُ بْنُ جَعْفَرٍ حَدَّثَنَا شُعْبَةُ عَنْ سُلَيْمَانَ قَالَ سَمِعْتُ إِبْرَاهِيمَ التَّيْمِيَّ يُحَدِّثُ عَنْ أَبِيهِ عَنْ أَبِي ذَرٍّ

عَنِ النَّبِيِّ ﷺ أَنَّهُ سَأَلَهُ عَنْ أَوَّلِ مَسْجِدٍ وُضِعَ لِلنَّاسِ قَالَ مَسْجِدُ الْحَرامِ ثُمَّ بَيْتُ الْمَقْدِسِ فَسُئِلَ كَمْ بَيْنَهُمَا؟ قَالَ أَرْبَعُونَ عَامًا وَحَيْثُمَا أَدْرَكَتْكَ الصَّلَاةُ فَصَلِّ فَثَمَّ مَسْجِدٌ  


See similar narrations below:

Collected by Ibn Ḥibbān, Nasāʾī's Kubrá
ibnhibban:1598Abū ʿArūbah > Muḥammad b. Bashhār > Ibn Abū ʿAdī > Shuʿbah > Sulaymān > Ibrāhīm al-Taymī from his father > Abū Dhar

"I said: 'O Messenger of Allah! Which mosque was built first?' He said: 'Al-Masjid Al-Haram (in Makkah).' I said: 'Then which?' He said: 'then Al-Masjid Al-Aqsa (in Jerusalem).' I said: 'How many years between them?' He said: 'Forty years, but the whole earth is a mosque for you, so pray wherever you are when the time for prayer comes.'" (Using translation from Ibn Mājah 753)   

ابن حبّان:١٥٩٨أَخْبَرَنَا أَبُو عَرُوبَةَ قَالَ حَدَّثَنَا مُحَمَّدُ بْنُ بَشَّارٍ قَالَ حَدَّثَنَا ابْنُ أَبِي عَدِيٍّ عَنْ شُعْبَةَ عَنْ سُلَيْمَانَ عَنْ إِبْرَاهِيمَ التَّيْمِيِّ عَنْ أَبِيهِ عَنْ أَبِي ذَرٍّ قَالَ

قُلْتُ يَا رَسُولَ اللَّهِ أَيُّ مَسْجِدٍ وُضِعَ أَوَّلُ؟ فَقَالَ «الْمَسْجِدُ الْحَرَامُ ثُمَّ الْمَسْجِدُ الْأَقْصَى» قَالَ قُلْتُ كَمْ كَانَ بَيْنَهُمَا؟ قَالَ «كَانَ بَيْنَهُمَا أَرْبَعُونَ سَنَةً وَحَيْثُ مَا أَدْرَكَتْكَ الصَّلَاةُ فَصَلِّ فَثَمَّ مَسْجِدٌ»  

قَوْلُهُ تَعَالَى: {إِنَّ أَوَّلَ بَيْتٍ وُضِعَ لِلنَّاسِ} [آل عمران: 96]

nasai-kubra:11003Bishr b. Khālid > Ghundar > Shuʿbah > Sulaymān > Ibrāhīm from his father > Abū Dhar

[Machine] The Prophet ﷺ was asked about the first mosque built for the people. He said, "The Sacred Mosque (in Mecca) and the Al-Aqsa Mosque." He was asked about the time period between them. He said, "Forty years, and wherever prayer reaches you, pray, for that place is also a mosque."  

الكبرى للنسائي:١١٠٠٣أَخْبَرَنَا بِشْرُ بْنُ خَالِدٍ حَدَّثَنَا غُنْدَرٌ عَنْ شُعْبَةَ عَنْ سُلَيْمَانَ قَالَ سَمِعْتُ إِبْرَاهِيمَ يُحَدِّثُ عَنْ أَبِيهِ عَنْ أَبِي ذَرٍّ

عَنِ النَّبِيِّ ﷺ أَنَّهُ سَأَلَهُ عَنْ أَوَّلِ مَسْجِدٍ وُضِعَ لِلنَّاسِ قَالَ «مَسْجِدُ الْحَرَامِ وَبَيْتُ الْمَقْدِسِ» فَسُئِلَ كَمْ بَيْنَهُمَا؟ قَالَ «أَرْبَعُونَ عَامًا وَحَيْثُ مَا أَدْرَكَتْكَ الصَّلَاةُ فَصَلِّ فَثَمَّ مَسْجِدٌ»