All of the best science fiction, in my humble opinion, is that which introduces the reader, or watcher, or whatever, to scenarios or ideas that they would not otherwise encounter. Or, failing that, places philosophical questions that are not uncommon into a context that allows them to be viewed from an alternate perspective.
Star Trek does this with an unparalleled frequency and zeal. While one could argue that the various incarnations of Star Trek are more or less philosophical than others, I think there is good philosophy in every Star Trek series. I don't agree with all of it, but I think every question the show raises is worth exploring, if only for curiosity's sake.
The Original Series of course dealt with a lot of the social and political issues of the 1960s, but the other shows seemed rather interested in exploring the more abstract, ubiquitous philosophical questions that stood the test of time, as it were. These are questions that everyone who has ever lived has asked themselves at some point or another. They're questions that, in some cases, still have yet to be answered.
One example that comes to mind is the Star Trek: The Next Generation episode "The Measure of a Man," which explores the question of whether the android Data was a Starfleet officer, or whether he was really just Starfleet property. In it, Data expresses certain wishes and seems to have a will of his own, but at the same time, he has no emotions. It isn't as if denying him those wishes would cause him any kind of suffering.
This episode was one of many that explored interesting ideas and morally ambiguous questions.
Interestingly, my favorite episode of Star Trek that deals with morality comes from a series that is often regarded as the worst of the bunch. It's an episode of Enterprise called "Cogenitor." Enterprise as a series takes place at a time in Starfleet history before the Prime Directive was ratified, and this episode explores some of the reasons why non-interference became such an important value for the Federation.
On the one hand, it asks, "Well, shouldn't you intervene if you see some injustice occurring?" It does this while also wondering whether it is a wise idea to interfere with a culture that you don't entirely understand. And what I really like about this episode and the show as a whole, is that while it leans in the direction of non-interfeerence, it leaves the question a little bit open, so that the viewer has agency. We are exposed to new ways of thinking, but it is left up to us what we do with the knowledge we are given.
That's why I love Star Trek.
Just something to think about.