The Messenger of Allah ﷺ rode a horse and was thrown from it, injuring his right side. He performed one of the prayers while seated, so we prayed behind him seated as well.When he finished, he said, "The imam is appointed only to be followed. When he prays standing, pray standing. When he bows, bow. When he says, 'Allah hears whoever praises Him,' say, 'Our Lord, to You belongs all praise.' And when he prays sitting, all of you pray sitting."
أخبرنا قتيبة عن مالك عن ابن شهاب
أن رسول الله ﷺ ركب فرسا فصرع عنه فجحش شقه الأيمن فصلى صلاة من الصلوات وهو قاعد فصلينا وراءه قعودا فلما انصرف قال إنما جعل الإمام ليؤتم به فإذا صلى قائما فصلوا قياما وإذا ركع فاركعوا وإذا قال سمع الله لمن حمده فقولوا ربنا لك الحمد وإذا صلى جالسا فصلوا جلوسا أجمعون
Reported by Muslim, Prayer, chapter "The person being led following the imam," hadith 411, from Qutayba, and by Bukhari, Adhan, chapter "The imam is appointed only to be followed," hadith 689, from the hadith of Malik through this same chain. It is also found in Muwatta (Yahya), 1/135, and in Al-Kubra, hadith 906.