Anas bin Malik reported,

He reported that the Messenger of Allah ﷺ fell from a horse and was injured, so he led us in prayer while seated, and we prayed behind him seated as well. When he finished, he said, "The imam, or rather, the imam has been appointed only to be followed. So when he says the takbir, say the takbir. When he bows, bow. When he rises, rise. When he says, 'Allah hears whoever praises Him,' say, 'Our Lord, to You belongs all praise.' When he prostrates, prostrate. And when he prays seated, all of you pray seated."

Tirmidhi 361

Sahih

حدثنا قتيبة حدثنا الليث عن ابن شهاب

عن أنس بن مالك

أنه قال خر رسول الله ﷺ عن فرس فجحش فصلى بنا قاعدا فصلينا معه قعودا ثم انصرف فقال إنما الإمام أو إنما جعل الإمام ليؤتم به فإذا كبر فكبروا وإذا ركع فاركعوا وإذا رفع فارفعوا وإذا قال سمع الله لمن حمده فقولوا ربنا ولك الحمد وإذا سجد فاسجدوا وإذا صلى قاعدا فصلوا قعودا أجمعون

الترمذي 361صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami Tirmidhi
Book
Prayer
Chapter
Praying seated if the imam prays seated
Numbering
Darussalam 361
Tirmidhi 361