Abu Dharr reported,

Someone asked the Prophet ﷺ about the first mosque established for mankind. He replied, "The Sacred Mosque."The questioner then asked, "Which was next?"He said, "Bayt al-Maqdis."The questioner asked, "How long was the period between them?"He answered, "Forty years. And wherever the time of prayer overtakes you, pray, for that place is a mosque."

Ahmad 21468

Sahih

حدثنا محمد بن جعفر حدثنا شعبة عن سليمان قال سمعت إبراهيم التيمي يحدث عن أبيه

عن أبي ذر

عن النبي ﷺ أنه سأله عن أول مسجد وضع للناس قال المسجد الحرام ثم بيت المقدس فسئل كم بينهما قال أربعون عاما وحيثما أدركتك الصلاة فصل فثم مسجد

أحمد 21468صحيح
Contents
Reference
Commentary
Ayat
Collection
Musnad Ahmad
Book
Abu Dharr Ghifari
Numbering
Darussalam 21468
Ahmad 21468