Euthanasia, assisted suicide or mercy killing was the process of killing a person or animal for reasons considered to be merciful, such as to prevent the prolonged suffering of a terminally ill person or animal.
Terminally ill persons may choose to commit suicide, or to be euthanized by means of assisted suicide.
In 2237, the decision was made to euthanize Spock's beloved pet sehlat I-Chaya when he was mortally wounded, rather than let the creature's suffering be prolonged. This was a critical turning point in the young half-Vulcan's life. (TAS: "Yesteryear")
Doctor Leonard McCoy reluctantly euthanized his father after his father pleaded with him to "release me" from his never-ending agony by turning off his life support equipment. The guilt and anguish the doctor felt for this event was only made worse by the fact that a cure for his father's disease was discovered shortly after the man's death. (Star Trek V: The Final Frontier)
Klingons who had suffered an injury or wound that precluded their further service to the Empire might euthanize themselves by performing ritual suicide in a ceremony known as the Hegh'bat. In 2368 it was permissible for Starfleet personnel to assist in the Hegh'bat. (TNG: "Ethics")
In 2371, after losing his lungs to the Vidiians and lying in the USS Voyager's sickbay confined to an isotropic restraint, Neelix surmised that Tom Paris might try to "pull the plug" meaning euthanizing him and having Kes all to himself. (VOY: "Phage")
The Vhnori euthanized their own people who had incurable illnesses or diseases in a cenotaph for the purpose of entering the Next Emanation. Sometimes people who their families perceived as burdens were pressured into this. (VOY: "Emanations")