It is not the untimely death but the state of consciousness that is important. Suicide is generally committed in a state of extreme mental agony which one continues to carry after death. There is also the question of deliberately cutting off the thread of your life thereby becoming an additional immediate cause of suffering to others by escaping from one’s challenges and responsibilities.
Dying on a battlefield is different, especially if one is truly charged with the spirit of sacrifice for the country or the cause. Here the future destiny may even be beautiful and glorious since sacrifice brings favor from the higher powers.
Sudden accidental deaths generally throw the person in quite a disoriented and confused state. It is helpful if someone can send such a person thoughts of peace and love.