Answered by Shaykh Faraz Rabbani
Can one pray behind someone who started the prayer without intending to be Imam. For example would it be permissible to join someone who is praying maghrib alone?
In the Name of Allah, Most Merciful and Compassionate. May His blessings and peace be on His Beloved Prophet, the best of creation, and his family, companions, and followers.
Walaikum assalam,
Yes, it is permitted to pray behind such a personit is not a condition for validity that the imam intend to lead, and this intention can be made post facto. However, one must be sure that the imam is in fact performing the very same obligatory prayer one is performing.
[Kasani, Bada’i` al-Sana’i`; Shurunbulali, Maraqi al-Falah]
Wassalam,
Faraz Rabbani