The Ruling on a Latecomer acting as Imam
Question :
A man entered the mosque after the Imam had made his Taslim, but he found a latecomer completing what he had missed of the congregational prayer, so he stood beside him, making the latecomer his Imam, so that he might achieve the reward of the congregational prayer. Is this permissible, or is it that the latecomer may not act as Imam? Is the prayer he performed with this latecomer correct?
Answer:
If the latecomer enters the mosque after the people have already prayed, and he finds another latecomer praying, it is permissible to pray with him, standing on his right side, in order to gain the reward of prayer in congregation. The other person should make the intention of being Imam, and there is no sin in this, according to the most authoritative of two opinions held by the scholars.
Likewise, if he found a person praying, he should pray with him, standing on his right side, with the intention of gaining the reward of the congregational prayer. If the latecomer or the one who prayed alone made the Taslim, the one who arrived late should stand up and complete what he has missed, based upon the generality of the proofs showing the virtue of praying in congregation, and the authentic report from the Prophet stating that when he saw a man enter the mosque after the prayer had ended, he said:
"Is there no man who will give charity to this (man) by praying with him?
Source:
Ibn Baz
Fatawa Islamiyah, Vol. 2 Pages 162-163