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
My mother, Um Sulaim, took a Mudd of barley grain, ground it and made porridge from it, and pressed (over it), a butter skin she had with her. Then she sent me to the Prophet, and I reached him while he was sitting with his companions. I invited him, whereupon he said, "And those who are with me?' I returned and said, "He says, 'And those who are with me?" Abu Talha went out to him and said, "O Allah's Messenger (ﷺ)! It is just a meal prepared by Um Sulaim." The Prophet (ﷺ) entered and the food was brought to him. He said, "Let ten persons enter upon me." Those ten entered and ate their fill. Again he said, 'Let ten (more) enter upon me." Those ten entered and ate their fill. Then he said, "Let ten (more) enter upon me." He called forty persons in all Then Allah's Messenger (ﷺ) ate and got up. I started looking (at the food) to see if it decreased or not.
Reference: Sahih al-Bukhari 5450 In-book : Book 70, Hadith 79 USC-MSA web (English) : Vol. 7, Book 65, Hadith 361 (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.