كتاب الصلاة
4  
The Book of Prayers
(21)
Chapter: If The Imam Experiences An Excuse, From Illness, Or Travelling, Etc. He May Appoint Someone Else To Lead The People In Prayer; The One Who Offers Prayer Behind The Imam Sitting Because He Is Unable To Stand Must Stand If He Is Able To Do So; And The Abrogation Of Sitting Behind A Sitting Imam For Those Who Are Able To Stand
(21)
باب اسْتِخْلاَفِ الإِمَامِ إِذَا عَرَضَ لَهُ عُذْرٌ مِنْ مَرَضٍ وَسَفَرٍ وَغَيْرِهِمَا مَنْ يُصَلِّي بِالنَّاسِ وَأَنَّ مَنْ صَلَّى خَلْفَ إِمَامٍ جَالِسٍ لِعَجْزِهِ عَنِ الْقِيَامِ لَزِمَهُ الْقِيَامُ إِذَا قَدَرَ عَلَيْهِ وَنَسْخِ الْقُعُودِ خَلْفَ الْقَاعِدِ فِي حَقِّ مَنْ قَدَرَ عَلَى الْقِيَامِ
Sahih Muslim 419 d

Anas reported:

The Apostle of Allah (ﷺ) did not come to us for three days. When the prayer was about to start. Abu Bakr stepped forward (to lead the prayer), and the Messenger of Allah (ﷺ) lifted the curtain. When the face of the Messenger of Allah (ﷺ) became visible to us, we (found) that no sight was more endearing to us than the face of the Messenger of Allah (ﷺ) as it appeared to us. The Apostle of Allah (ﷺ) with the gesture of his hand directed Abu Bakr to step forward (and lead the prayer). The Apostle of Allah (ﷺ) then drew the curtain, and we could not see him till he died.
حَدَّثَنَا مُحَمَّدُ بْنُ الْمُثَنَّى، وَهَارُونُ بْنُ عَبْدِ اللَّهِ، قَالاَ حَدَّثَنَا عَبْدُ الصَّمَدِ، قَالَ سَمِعْتُ أَبِي يُحَدِّثُ، قَالَ حَدَّثَنَا عَبْدُ الْعَزِيزِ، عَنْ أَنَسٍ، قَالَ لَمْ يَخْرُجْ إِلَيْنَا نَبِيُّ اللَّهِ صلى الله عليه وسلم ثَلاَثًا فَأُقِيمَتِ الصَّلاَةُ فَذَهَبَ أَبُو بَكْرٍ يَتَقَدَّمُ فَقَالَ نَبِيُّ اللَّهِ صلى الله عليه وسلم بِالْحِجَابِ فَرَفَعَهُ فَلَمَّا وَضَحَ لَنَا وَجْهُ نَبِيِّ اللَّهِ صلى الله عليه وسلم مَا نَظَرْنَا مَنْظَرًا قَطُّ كَانَ أَعْجَبَ إِلَيْنَا مِنْ وَجْهِ النَّبِيِّ صلى الله عليه وسلم حِينَ وَضَحَ لَنَا - قَالَ - فَأَوْمَأَ نَبِيُّ اللَّهِ صلى الله عليه وسلم بِيَدِهِ إِلَى أَبِي بَكْرٍ أَنْ يَتَقَدَّمَ وَأَرْخَى نَبِيُّ اللَّهِ صلى الله عليه وسلم الْحِجَابَ فَلَمْ نَقْدِرْ عَلَيْهِ حَتَّى مَاتَ ‏.‏
Reference : Sahih Muslim 419d
In-book reference : Book 4, Hadith 109
USC-MSA web (English) reference : Book 4, Hadith 843
  (deprecated numbering scheme)