Sahih al-Bukhari, Hadith 4586

Narrated `Aisha: I heard Allah's Messenger saying, "No prophet gets sick but he is given the choice to select either this world or the Hereafter." `Aisha added: During his fatal illness, his voice became very husky and I heard him saying: "In the company of those whom is the Grace of Allah, of the prophets, the Siddiqin (those followers of the prophets who were first and foremost to believe in them), the martyrs and the pious.' (4.69) And from this I came to know that he has been given the option.

حَدَّثَنَا مُحَمَّدُ بْنُ عَبْدِ اللَّهِ بْنِ حَوْشَبٍ، حَدَّثَنَا إِبْرَاهِيمُ بْنُ سَعْدٍ، عَنْ أَبِيهِ، عَنْ عُرْوَةَ، عَنْ عَائِشَةَ ـ رضى الله عنها ـ قَالَتْ سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ ‏"‏ مَا مِنْ نَبِيٍّ يَمْرَضُ إِلاَّ خُيِّرَ بَيْنَ الدُّنْيَا وَالآخِرَةِ ‏"‏‏.‏ وَكَانَ فِي شَكْوَاهُ الَّذِي قُبِضَ فِيهِ أَخَذَتْهُ بُحَّةٌ شَدِيدَةٌ فَسَمِعْتُهُ يَقُولُ ‏{‏مَعَ الَّذِينَ أَنْعَمَ اللَّهُ عَلَيْهِمْ مِنَ النَّبِيِّينَ وَالصِّدِّيقِينَ وَالشُّهَدَاءِ وَالصَّالِحِينَ‏}‏ فَعَلِمْتُ أَنَّهُ خُيِّرَ‏.‏

sunnah.com