Sayyiduna Anas bin Malik (may Allah be pleased with him) says that the Messenger of Allah (peace and blessings be upon him) fell from a horse and his right side was injured. We came to visit him (peace and blessings be upon him) in his illness, and he (peace and blessings be upon him) prayed sitting, so we also prayed sitting. When he (peace and blessings be upon him) completed the prayer, he said: "The imam is appointed only to be followed. When he says 'Allahu akbar' (Allah is the Greatest), you too say 'Allahu akbar'; when he bows, you too bow; when he says 'Sami'a Allahu liman hamidah' (Allah hears the one who praises Him), you say 'Rabbana wa lakal-hamd' (Our Lord, and to You belongs all praise); and when he prays sitting, then all of you pray sitting."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5069