It was narrated from Abu Dharr that the Prophet (ﷺ) said:“Offer prayer on time, and if you reached the Imam leading them in prayers (on time), then perform it with them, and you will be safe with your prayer, otherwise it will be voluntary for you.”
Hadith No. 1256
Sunan Ibn Majah
Gradings:
Al-Albani:
Sahih
Muhammad Fouad Abd al-Baqi:
Sahih
Shuaib Al Arnaut:
Sahih
Zubair Ali Zai:
Sahih Muslim