Narrated ‘Aisha:
I heard Allah’s Apostle 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.
Sahih Bukhari, Volume 6, Book60, Number 110