It’s ambiguous what counts as being “written out”, but there are a few possible examples:
Almost Everyone from The Cage
Star Trek famously switched almost the entire cast in between the original pilot episode and the main series,with only Leonard Nimoy as Spock returning as a regular. Of these, Captain Pike (Jeffrey Hunter), Dr. Phillip Boyce (John Hoyt), and José Tyler (Peter Duryea) would likely have gone on to be major characters had the show continued with this cast. Captain Pike returned for the epsiode The Menagerie, as well as the Kelvin movies and the upcoming season 2 of Discovery (played by three different actors), but the others have never reappeared outside of clips from The Cage that were reused in The Menagerie.
Deceased Characters from Star Trek Discovery
Season one of Discovery killed off several major characters.
Dr. Hugh Culber (Wilson Cruz) was murdered by Tyler/Voq in episode 10 Despite Yourself. He appeared as a hallucination in a later episode Vaulting Ambition, but remains dead as of the end of season one.
Another death came a few episodes later
Captain Gabriel Lorca (Jason Isaacs) was revealed to be a Mirror Universe double, and was killed by Georgiou in episode 13 What’s Past is Prologue. He has not reappeared in any form since this, although the Mirror Universe storyline gives an obvious hook to bring back Jason Isaacs as Prime Universe Lorca (technically a different character).
Chief O’Brien
Something of a stretch, but after Rascals, episode 7 of season six of TNG, Chief O’Brien was written out of the show, only reappearing in the past sections of the series finale. The reason for this was of course that he had taken a much bigger role on spin-off series Deep Space Nine.
Possible Future Examples From Kelvin Movies
Anton Yelchin, who played Chekov in the first three Kelvin movies, tragically died in a car accident in 2016. When asked about what this means for the character, J. J. Abrams was against recasting:
I would say there's no replacing him. There's no recasting. I can't possibly imagine that, and I think Anton deserves better. ... I have thought about [how he'll be replaced], we're working on it, and it's too early to talk about it.
(Source: Cinemablend)
The future movies have since been thrown into doubt after Chris Pine rejected a contract, which could potentially also mean Kirk being written out or recast if the movie does go ahead.