Narrated Anas bin Malik:Once Allah's Apostle rode a horse and fell down and the right side (of his body) was injured. He offered one of the prayers while sitting and we also prayed behind him sitting. When he completed the prayer, he said, "The Imam is to be followed. Pray standing if he prays standing and bow when he bows; rise when he rises; and if he says, 'Sami a-l-lahu-liman hamida, say then, 'Rabbana wa Lakal-hamd' and pray standing if he prays standing and pray sitting (all of you) if he prays sitting."
Humaid said: The saying of the Prophet "Pray sitting, if he (Imam) prays sitting" was said in his former illness (during his early life) but the Prophet prayed sitting afterwards (in the last illness) and the people were praying standing behind him and the Prophet did not order them to sit. We should follow the latest actions of the Prophet.