Reference: al-Fataawa al-Muta’alliqah bit-Tibb wa Ahkaam al-Mardhaa – Page 451
Question: A person is infected with AIDS and the doctors have determined that his life will be very short. So what is the ruling regarding his repentance at this time?
Response: He is required to hasten in making repentance, even if he is in the final moments of life. This is because the door to repentance is open whatever the state of the person – so long as he is sane; He is required to hasten in making repentance and beware of [further] sin, and if they say to him “You will have a short life”, then life is in the Hands of Allaah. Such is the case that their opinion may be incorrect and so he lives a long life. Whatever the hypothesis, it is obligatory upon him to hasten in truthfully repenting [to Allaah] for what has preceded, so Allaah will forgive him [in shaa.-Allaah]; As Allaah says:
…and He says:
…and the saying of the Prophet (sal-Allaahu ‘alayhi wa sallam):
And the meaning of this is – so long as he has not breathed his last breath. And Allaah is the One from whom assistance is sought.