If somebody is leading the Salat (prayer) and (in the meanwhile) the first (usual) Imam comes, the Salat is valid whether the former retreats or does not retreat
حَدَّثَنَا مُحَمَّدُ بْنُ بَشَّارٍ، حَدَّثَنَا مُحَمَّدُ بْنُ جَعْفَرٍ، حَدَّثَنَا شُعْبَةُ، عَنْ عَبْدِ الْعَزِيزِ، عَنْ أَنَس ٍ ـ رضى الله عنه ـ قَالَ أُقِيمَتِ الصَّلاَةُ وَرَجُلٌ يُنَاجِي رَسُولَ اللَّهِ صلى الله عليه وسلم فَمَا زَالَ يُنَاجِيهِ حَتَّى نَامَ أَصْحَابُهُ، ثُمَّ قَامَ فَصَلَّى.
Narrated Anas:
The Iqama for the prayer was announced while a man was talking to Allah's Messenger (ﷺ) privately. He continued talking in that way till the Prophet's companions slept, and afterwards the Prophet (ﷺ) got up and offered the prayer with them.
Reference: Sahih al-Bukhari 6292 In-book : Book 79, Hadith 64 USC-MSA web (English) : Vol. 8, Book 74, Hadith 307 (deprecated)
Help us gift a modern, ad-free Islamic application for the Muslim Ummah. Your donation will be recorded as Sadaqah Jariyah in your book of deeds, In Sha Allah.