I was present with the Messenger of Allah ﷺ during his pilgrimage. I prayed the dawn prayer with him in the Mosque of al-Khayf. When he had completed his prayer, he noticed two men at the back of the mosque who had not prayed with him.He said, "Bring them to me."They were brought, trembling with fear.He asked them, "What kept you from praying with us?"They replied, "Messenger of Allah, we had already prayed at our lodgings."He said, "Do not do that. If you have prayed at your lodgings and then come to a mosque where the congregation is praying, pray with them. It will count as a voluntary prayer for you."Ubayy said, sometimes it was said to Hushaym, "When he had completed his prayer, he turned around," meaning he turned from his place.
حدثنا هشيم حدثنا يعلى بن عطاء قال حدثني
شهدت مع رسول الله ﷺ حجته قال فصليت معه صلاة الفجر في مسجد الخيف فلما قضى صلاته إذا هو برجلين في آخر المسجد لم يصليا معه فقال علي بهما فأتي بهما ترعد فرائصهما قال ما منعكما أن تصليا معنا قالا يا رسول الله قد كنا صلينا في رحالنا قال فلا تفعلا إذا صليتما في رحالكما ثم أتيتما مسجد جماعة فصليا معهم فإنها لكما نافلة قال أبي وربما قيل لهشيم فلما قضى صلاته تحرف فيقول تحرف عن مكانه
Its chain of transmission is sahih. Abu Dawud narrated it, 1/157, no. 575, in the chapter on prayer, regarding one who prays in his house. Tirmidhi narrated something similar, 1/425, no. 219, in the chapter on prayer, on what has been said about the man who prays alone, and he said, hasan sahih. Nasai also narrated it, 2/212, no. 858, in the chapter on leadership in prayer, on repeating Fajr with the congregation, as did Ibn Hibban, 122, no. 434, Mawarid.