Is it good to pray magrib with Imam when they’re praying ishai.
In the name of Allah, the Beneficent, the Merciful.
All praises are due to Allah the Lord of the worlds. May His peace and blessings be upon our leader- Muhammad, his family and companions and all the followers of his guidance till the day of recompense.
O Allah grant us beneficial knowledge of the deen.
It is an established tradition of solat in Islam that it is permissible in solat to have difference in intention; between the Imam and the congregation. This is clearly reported on several accounts in the pristine sunnah.
Mu’aadh bn Jabal would observe solatul- isha with the prophet (peace be upon him), then he would return to his people and lead them in the same solat- isha. In that situation his solat with his people would be supererogatory while it is the obligatory prayer for his people.
Therefore, it is permissible to observed solatul maghrib behind an Imam observing solatul ishaa. When the Imam stands for the fourth rak’at of isha, the person observing maghib would remain seated to say the last tashahud (meaning: At-tahiyyaatu lillah …, solatu ‘ala-n-nabiyyi, and the recommended prayers for that position), untill the Imam returns to complete his fourth rak’at and do the tasleem, he should then follow the Imam in that and do the tasleem.- this is better to preserve the following of Imam in solat.
Some scholars as well believe it is permissible for the person observing maghrib to do the tasleem after the tashahud to end his solat without waiting for the Imam, and then, stand up again to join the Imam in order continue solatul- isha with him.
Apart from the above, it is acceptable as well to firstly observe solatul- maghrib alone, then join the Imam at whatever remains of the solatul- isha.
Allah knows best.