All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
According to the view that it is permissible for the Imaam to choose someone to replace him during the prayer if something happens to him [like if his ablution is invalidated during the prayer] – and this is the opinion of the jurists from among the Hanafi, and Maaliki Schools, and this is the strongest opinion in the Shaafi’i School and a narration from Imaam Ahmad in the Hanbali School – then the Imaam takes one of the praying people by his hand and brings him forward to lead the prayer.
Besides, the jurists stated that it is preferable for the Imaam to choose the nearest person to him in the row behind to replace him so that it would be easier for the congregants to follow him, and because such a person is more aware of the circumstances of the Imaam. So, he should choose the nearest person among the people who are praying behind him from the row that is behind him.
They also stated that during the Friday prayer, the person who is most eligible to be chosen to replace the Imaam should be among those who attended the Khutbah. The Fiqh Encyclopedia, quoting the view of the Maaliki School in regard to choosing someone to replace the Imaam in the Friday prayer, reads: “…It is more appropriate for the congregation to put forward someone who attended the Khutbah, but if they choose someone who did not attend the Khutbah, then this is sufficient for them [i.e. acceptable], but it is not permissible to choose someone upon whom attending the Friday prayer is not obligatory, like a traveler. Imaam Maalik said: “In my view, it is disliked to choose someone who did not attend the Friday Khutbah to replace the Imaam.”
Allaah Knows best.