Praise be to Allah.
It is Sunnah to prompt a dying person to say Laa ilaaha illa Allah (there is no god worthy of worship except Allah), so that these will be the last words he says in this world.
Muslim (916) narrated that Abu Sa‘eed al-Khudri said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Prompt your dying ones to say, Laa ilaaha illa Allah.”
Ibn Hibbaan (3004) narrated that Abu Hurayrah said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Prompt your dying ones to say Laa ilaaha illa Allah, for the one whose last words are Laa ilaaha illa Allah when he dies will enter Paradise eventually, even if he suffers before that.” Classed as saheeh by Shu‘ayb in Tahqeeq Ibn Hibbaan.
This does not mean that the dying person can do without repenting from his sins, for if he does not repent from them, he will be subject to the divine will, and he may enter the Fire, even though he said Laa ilaaha illa Allah before he died, as is indicated by the hadith quoted above.
Hence it is recommended (mustahabb) to encourage the one who is sick or dying to repent, if they are in a state in which they can be reminded of that and benefit from it, so long as that does not cause him annoyance and is not burdensome for him, because of what that may lead to of bad consequences, and that should not be towards the end of his life, especially when he is about to die; at that time there should be no scaring him or saying things to make him reluctant to meet the Lord of the Worlds; rather at that moment we should try to say things to increase his hope of Allah’s mercy, put him at ease and make him eager to meet the Lord of the Worlds, and make him like to depart this world and meet the Most Merciful of those who show mercy.
With regard to visiting the sick, the fuqaha’ mentioned reminding the sick person to repent, but in the case of one who is dying, they limited it to prompting the dying person to say Laa ilaaha illa Allah. That is because there may be only enough time for that, because reminding him to repent has already happened in previous visits.
It says in Akhsar al-Mukhtasaraat, p. 132: It is Sunnah to prepare for death and remember it a great deal, and to visit the sick Muslim and remind him to repent and make a will. But when he is dying, it is Sunnah to keep watch and, in fact, to wet his throat with water or another drink, wet his lips, and prompt him to say Laa ilaaha illa Allah once and no more than three times, unless he speaks, then you gently can remind him to say it again. End quote.
He said in his commentary Kashf al-Mukhaddiraat (1/218): It is Sunnah to remind the sick person to repent, because that is obligatory for everyone to repent from every sin at all times, and because he needs that more than others. It is also Sunnah to remind him to make a will and to find a way to seek people’s pardon; we should encourage him to do that, even if his sickness is not serious. There is nothing wrong with the visitor putting his hand on him. The Sunnah is not to stay too long [when visiting one who is sick], because that could make him uneasy and prevent him from doing things comfortably.
But when he is dying – meaning when the angel of death comes to take his soul – it is Sunnah to wet his throat; that should be done by the kindest of his family to him, and the one who has most knowledge of his treatment, and the one who fears Allah the most. That should be done with water or another drink and his lips should be moistened with a piece of damp cloth, to relieve the suffering he is going through and to make it easier for him to utter the shahaadah. It is Sunnah to prompt the sick person to say Laa ilaaha illa Allah once, but that should not be repeated more than three times, unless he speaks after the third time, in which case he should be prompted to say it again, so that his last words will be Laa ilaaha illa Allah. That should be done gently, because kindness is required in all things, and even more so in this case. End quote.
Based on that, if there is sufficient time and the person is conscious and it is possible, then he may be reminded to repent, especially if he is known to have fallen into shirk, bid‘ah or other major sins.
If there is not enough time, such as if he is dying, then the focus should be on prompting him to utter the shahaadah.
And Allah knows best.