When God’s Messenger was seriously ill* and Bilal came to announce the time of prayer for him, he said, “Order Abu Bakr to lead the people in prayer.” So Abu Bakr led the prayer during those days, then when the Prophet experienced some improvement in his condition he got up and came into the mosque swaying between two men with his feet touching the ground. On hearing the sound Abu Bakr began to withdraw, but God’s Messenger signed to him not to do so. He then came and sat at Abu Bakr’s left, and Abu Bakr prayed standing and God’s Messenger prayed sitting, Abu Bakr following God’s Messenger’s prayer, while the people followed Abu Bakr’s.
* Here the reference is to the Prophet's last illness.
(Bukhari and Muslim.) They both have a version which says that Abu Bakr caused the people to hear the takbir.
‘Ali and Mu'adh b. Jabal reported God’s Messenger as saying, “When any of you comes to pray and the imam is at a certain point, he must do as the imam does.”
Tirmidhi transmitted it and said this is a gharib tradition.
Anas said God’s Messenger was thrown off a horse he was riding and his right side was grazed. He then prayed one of the prayers sitting and we prayed behind him sitting, and when he finished he said, "The imam is appointed only to be followed; so when he prays standing pray standing, when he bows bow, when he raises himself raise yourselves, when he says ‘God listens to him who praises Him say, ‘Our Lord, to Thee be the praise’, and when he prays sitting all of you pray sitting."
Al-Humaidi said that "when he prays sitting pray sitting" was said during his earlier illness.* After that the Prophet prayed sitting while the people behind him were standing, but he did not order them to sit, and it is only the last action of the Prophet that is to be acted upon.
* The reference is to his illness at the time when he swore not to go near his wives for a month.
This is Bukhari’s wording, and Muslim has the same up to “all of you”. In a version he added, “Do not act differently from him, and prostrate yourselves when he prostrates himself.”