Euthanasia was the process of killing someone for reasons considered to be merciful, such as to prevent the prolonged suffering of a terminally ill person.
In Spock's youth, the decision was made to euthanize his beloved pet sehlat I-Chaya when he was mortally wounded, rather than have an extended life in agony. 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 his death. (Star Trek V: The Final Frontier)
Klingons who have suffered an injury or wound that precludes their further service to the Empire may euthanize themselves by performing ritual suicide in a ceremony known as 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")