Suicide of a person of a mainstream western culture is the ultimate act of selfishness.
That doesn't mean that it may not be appropriate in some instances. It means that in western cultures the decision to suicide is usually made at a time when the person is seriously under estimating his value to his circle of family, friends, and acquaintances.
Other cultures value things differently. Suicide in some eastern cultures is apparently sometimes regarded as a way of protecting the person's social circle from the burden of shame that his dishonorable actions would otherwise tar them with. Suicide in some warrior cultures is apparently sometimes a self-sacrifice for the benefit of the warrior's brethren or for those he has been fighting for. Suicide bombers appear to be a special case where brainwashing techniques have been used to artificially impose portions of the warrior ethic on the suggestible. There are definitely crimes involved with that last, but it would seem that in almost all cases the suicide bomber is another victim and not one of the perps.
Should any of these be legalized? With our current modes of handling estates and insurances policies, etc, probably not. We would end up in a hellacious mess. Can you imagine the circus lawyers would make over the insurance policy of the ex soldier who wrapped himself around a live grenade in the crowded subway? Lawyers, actuaries, and writers of insurance policies already have too much space for erecting their circus tents.
Should the crimes of suicide or attempted suicide be prosecuted? In general, no. There might be specific instances where this should be done: I think someone who straps on a dynamite vest should have all his insurance policies summarily cancelled. But these situations are rare in western societies; most of the time prosecution would just visit more hardship on the survivors with no particular benefit to anyone.