Once Messenger of Allah ﷺ 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 hamidah, say then, 'Rabbana wa laka lhamd' 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.
أَنَّ رَسُولَ اللَّهِ ﷺ رَكِبَ فَرَسًا فَصُرِعَ عَنْهُ فَجُحِشَ شِقُّهُ الأَيْمَنُ فَصَلَّى صَلاَةً مِنَ الصَّلَوَاتِ وَهْوَ قَاعِدٌ فَصَلَّيْنَا وَرَاءَهُ قُعُودًا فَلَمَّا انْصَرَفَ قَالَ إِنَّمَا جُعِلَ الإِمَامُ لِيُؤْتَمَّ بِهِ فَإِذَا صَلَّى قَائِمًا فَصَلُّوا قِيَامًا فَإِذَا رَكَعَ فَارْكَعُوا وَإِذَا رَفَعَ فَارْفَعُوا وَإِذَا قَالَ سَمِعَ اللَّهُ لِمَنْ حَمِدَهُ فَقُولُوا رَبَّنَا وَلَكَ الْحَمْدُ وَإِذَا صَلَّى قَائِمًا فَصَلُّوا قِيَامًا وَإِذَا صَلَّى جَالِسًا فَصَلُّوا جُلُوسًا أَجْمَعُونَ قَالَ أَبُو عَبْدِ اللَّهِ قَالَ الْحُمَيْدِيُّ قَوْلُهُ إِذَا صَلَّى جَالِسًا فَصَلُّوا جُلُوسًا هُوَ فِي مَرَضِهِ الْقَدِيمِ ثُمَّ صَلَّى بَعْدَ ذَلِكَ النَّبِيُّ ﷺ جَالِسًا وَالنَّاسُ خَلْفَهُ قِيَامًا لَمْ يَأْمُرْهُمْ بِالْقُعُودِ وَإِنَّمَا يُؤْخَذُ بِالآخِرِ فَالآخِرِ مِنْ فِعْلِ النَّبِيِّ ﷺ