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.
USC-MSA web (English) reference: Vol. 6, Book 60, Hadith 110
Arabic reference: Book 65, Hadith 4586