Yazid bin Aswad reported,

He prayed the dawn prayer with the Messenger of Allah ﷺ at Mina while he was a young lad. When the Messenger of Allah ﷺ finished his prayer, he noticed two men who had not prayed with them. He called for them, and they were brought trembling with fear.He asked them, "What kept you from praying with us?"They replied, "We had already prayed in our lodgings."He said, "Do not do that. If you have prayed in your lodgings and then come upon the imam who has not yet prayed, pray with him, and it will count as a voluntary prayer for you."

Ahmad 17479

Sahih

حدثنا محمد بن جعفر حدثنا شعبة عن يعلى بن عطاء

عن جابر بن يزيد بن الأسود عن أبيه

أنه صلى مع رسول الله ﷺ صلاة الصبح بمنى وهو غلام شاب فلما صلى رسول الله ﷺ إذا هو برجلين لم يصليا فدعا بهما فجيء بهما ترعد فرائصهما فقال لهما ما منعكما أن تصليا معنا قالا قد صلينا في رحالنا قال فلا تفعلا إذا صليتم في رحالكم ثم أدركتم الإمام لم يصل فصليا معه فهي لكم نافلة

أحمد 17479صحيح
Contents
Reference
Commentary
Ayat
Collection
Musnad Ahmad
Book
Yazid bin Aswad Amiri
Numbering
Darussalam 17479
Ahmad 17479