Science fiction sells in threes more consistently than almost any other category. The pattern comes from how the books are commissioned and sold rather than from a natural length for the stories.
Building a world is expensive to do once
A science fiction novel has to establish rules that a contemporary novel can assume: how the technology works, who governs, what the physical constraints are.
That construction consumes pages in the first book and cannot be reused by any other title. Spreading it across several books lowers the cost per volume.
By the second book the world is already standing, so the author can spend the space on plot instead.
Readers who have absorbed the rules also need less explanation, which is why later volumes in a sequence usually move faster than the first.
Publishers contract in multiples
Genre publishing frequently acquires more than one book at a time. A multi-book deal gives the publisher a series to build an audience around and gives the author time to write it.
Three is the common number because it is long enough to justify the investment in launching a new author and short enough that a publisher can stop without stranding readers.
The shape of the deal therefore precedes the shape of the story, and the story is planned to fit it.
Readers of the genre buy forward
Science fiction readers are unusually willing to commit to a continuing narrative, and the genre has trained them to expect one.
A reader who finishes the first volume is a near-certain buyer of the second, which makes each subsequent book cheaper to sell than a standalone.
Retailers reinforce this by shelving series together, so the later volumes advertise the first one on the shelf.
Three suits the middle of a story
A three-part structure gives a natural place for the difficult second act: expansion of the world, complication of the conflict, and a delay of resolution.
Longer sequences risk the audience thinning between volumes as readers forget details or lose patience with a delayed conclusion.
Three volumes also fit comfortably into a publishing schedule of roughly one book a year, which is close to the pace a working novelist can sustain.
What the format costs
Ideas that would work as a single tight novel are sometimes stretched to fill three, and the middle volume is where that stretching shows most often.
The countervailing pressure comes from standalone novels that sell well on their own, which periodically reminds the trade that the trilogy is a commercial convention rather than a requirement of the genre.