Praise be to Allah.Praise be to Allah.
In such cases, if a person dies in such circumstances, it has nothing to do with being praiseworthy or blameworthy in and of itself, and there is no Islamic ruling connected to that. Islamic rulings only have to do with the deeds of those who are accountable. If a person dies in a particular place, or at a particular time, or in a particular posture, that is not part of his deeds and it is not within his control, so there is no ruling that is connected to it.
With regard to the death of one who is fasting, this is the matter concerning which there are reports which point to its virtue, not because death in this situation was within his control, but because he died whilst doing a righteous deed and his life ended with that. It is the righteous deed that is within his control and is connected to the ruling of Allah. If a person dies doing such a deed, that is a blessing granted by Allah, may He be exalted, to His slave, and it is encouraged to constantly do such deeds, in the hope that one might die doing such a thing.
It was narrated that Hudhayfah (may Allah be pleased with him) said: The Prophet (blessings and peace of Allah be upon him) said: “Whoever fasts one day, seeking the Countenance of Allah, and his life ends with that, will enter Paradise.”
Narrated by Ahmad (no. 22235). Shaykh al-Arna’oot said: It is saheeh because of corroborating evidence.
It was also narrated by al-Bazzaar in his Musnad (1/436) as follows: “If a person’s life ends with a day of fasting, he will enter Paradise.” Classed as saheeh by Shaykh al-Albaani.
Al-Mannaawi (may Allah have mercy on him) said: The words “If a person’s life ends with a day of fasting” mean: if a person’s life concludes with a day of fasting, in the sense that he dies when he is fasting or after breaking his fast.
The words “will enter Paradise” mean: with those who enter it first, or without prior punishment.
End quote from Fayd al-Qadeer Sharh al-Jaami‘ as-Sagheer (6/160)
Muslim narrated in his Saheeh (5126) that Jaabir said: I heard the Messenger of Allah (blessings and peace of Allah be upon him) say: “Each person will be resurrected in the condition in which he died.”
Ibn al-Jawzi (may Allah have mercy on him) said: If a person dies in a particular condition, then his life ends with that, and in that condition he will be resurrected.
End quote from Kashf al-Mushkil min Hadeeth as-Saheehayn (1/751)
And Allah knows best.