A terminal illness was an incurable disease that ended with the death of the patient.
In 2364, Jean-Luc Picard described the Aldean civilization as being terminally ill, as they were incapable of reproducing. (TNG: "When The Bough Breaks")
In 2368, Picard asked William T. Riker whether he would see death as a release if he was facing a terminal, incurable illness (TNG: "Ethics")
Later that year, Deanna Troi compared Data's finding his own severed head to discovering that a loved one had a terminal illness. (TNG: "Time's Arrow")
Acute anxiety could result upon one's diagnosis with a terminal illness. In 2376, The Doctor described Lewis Zimmerman as suffering from anxiety related to his terminal illness. (VOY: "Life Line")