Praise be to Allah.
What the imam did, stopping his prayer and appointing one of the worshippers to lead the prayer for him, and what that person did by carrying on the prayer where the imam had left off, was all correct.
The view that it is permissible to appoint someone else to carry on in such situations is the view of the majority of Hanafi, Maaliki and Shaafa’i scholars, and it was narrated from Imam Ahmad.
Al-Nawawi (may Allaah have mercy on him) said: Our companions said: If the imam stops praying because of breaking wudoo’ deliberately or otherwise, or that happened before or he forgot or for some other reason, or for no reason, then there are two well known opinions on appointing someone else to carry on leading the prayer. The correct view is that it is permissible because of the saheeh hadeeth. It is proven in al-Saheehayn that the Messenger of Allaah (peace and blessings of Allaah be upon him) went to reconcile between Banu ‘Amr ibn ‘Awf, and Abu Bakr led the people in prayer. Then the Prophet (peace and blessings of Allaah be upon him) came during the prayer, and Abu Bakr moved backwards, and the Prophet (peace and blessings of Allaah be upon him) took over leading the prayer. End quote from al-Majmoo’ (4/138).
Shaykh Ibn ‘Uthaymeen said in al-Sharh al-Mumti’ (4/243): If the imam remembers during the prayer that he does not have wudoo’, then he has to stop praying and appoint someone to complete the prayer, because when ‘Umar ibn al-Khattab (may Allaah be pleased with him) was stabbed by Abu Lu’lu’ah al-Majoosi, after he had started to pray Subh, ‘Umar took the hand of ‘Abd al-Rahmaan ibn ‘Awf and made him move forward. And he led them in a brief prayer. (Narrated by al-Bukhaari).
This was in the presence of the Sahaabah, may Allaah be pleased with them. But if he does not do that and he moves away – i.e., without appointing someone to lead the prayer for him – then the members of the congregation have the choice between making one of their number move forward to complete the prayer with them, or completing the prayer individually. End quote.
And Allaah knows best.