(21) باب اسْتِخْلاَفِ الإِمَامِ إِذَا عَرَضَ لَهُ عُذْرٌ مِنْ مَرَضٍ وَسَفَرٍ وَغَيْرِهِمَا مَنْ يُصَلِّي بِالنَّاسِ وَأَنَّ مَنْ صَلَّى خَلْفَ إِمَامٍ جَالِسٍ لِعَجْزِهِ عَنِ الْقِيَامِ لَزِمَهُ الْقِيَامُ إِذَا قَدَرَ عَلَيْهِ وَنَسْخِ الْقُعُودِ خَلْفَ الْقَاعِدِ فِي حَقِّ مَنْ قَدَرَ عَلَى الْقِيَامِ
Abu Musa reported:
When the Messenger of Allah (ﷺ) became ill and illness became serious he ordered Abu Bakr to lead the people in prayer. Upon this 'A'isha said: Messenger of Allah, Abd Bakr is a man of tenderly feelings: when he would stand in your place (he would be so much overwhelmed -by grief that) he would not be able to lead the people in prayer. He (the Holy Prophet) said: You order Abu Bakr to lead the people in prayer, and added: You are like the female companions of Yusuf. So Abu Bakr led the prayer (during this period of illness) in the life of the Messenger of Allah (ﷺ).
Reference: Sahih Muslim 420
In-book reference: Book 4, Hadith 110
USC-MSA web (English) reference(deprecated numbering scheme): Book 4, Hadith 844