Answered by Shaykh Omar Qureshi
Question: In the Shafi’i school, as a traveler, does one shorten the ishaa prayer (or other prayers) if one prays in a congregation behind an imam?
Answer: Assalamu ‘alaikum.
In the Shafi’i school, if one is a traveler, one may shorten prayers the afternoon (zuhr), midafternoon (‘asr), and nightfall (‘isha) prayers to two raka’ah. If one is praying in a group and the imam is praying four raka’ah, then one may not shorten the number of raka’ah to two. Instead one must follow the imam and pray four raka’ah. This is the case whether one joined the congregation from the beginning or joined it even for a moment.
There are three scenarios in the case of one joining the congregation while one is not sure as to whether the imam is praying four or two raka’ah (if the imam is also traveling):
1) it is valid to shorten the prayer if one intended to shorten the prayer, and the imam also shortened his prayer
2) one must pray the full number of raka’ah if one intended to shorten the prayer, but the imam was praying the full number of raka’ah
3) if the follower intended that he will shorten if the imam shortens the prayer and pray the full number of raka’ah if the imam prays the full number, then one must follow the imam each of the cases. (I’anah al-Talibin, v. 2, p. 102-103)
Allah the Exalted knows.