It is narrated from Sayyiduna Yazid bin al-Aswad al-Suwa'i (may Allah be pleased with him); he said: I was present at the prayer with the Messenger of Allah (peace and blessings be upon him) in Masjid al-Khayf. When he (peace and blessings be upon him) finished the prayer, he saw two men sitting apart. They were brought while their bodies were trembling. The Prophet (peace and blessings be upon him) said: "What kept you from the prayer?" They said: "O Messenger of Allah, we had prayed in our camp." He (peace and blessings be upon him) said: "When you have prayed in your camp and then find the prayer with the people, pray it with them as well; and the one you prayed in your camp is the obligatory one."
Hadith Referenceالمعجم الكبير للطبراني / باب الياء / 18834