Supposedly the thing that characterizes science fiction as a genre is its interest in, well, science. And yet a lot of the very best treatments of science in novels lately have been in works that are classified as fantasy.
Image by Todd Lockwood from the cover of Marie Brennan's Voyage of the Basilisk
Of course there's the old adage that sufficiently advanced technology is indistinguishable from magic. Certainly a lot of fantasy novels have mined this idea fruitfully, from Philip Pullman's His Dark Materials saga, to Richard K. Morgan's recent fantasy/SF mashup The Steel Remains. But I'm not talking about the idea that advanced science looks like magic — that is, after all, an excuse for writing about science in a way that is handwavey and unscientific. I'm talking about fantasy writing where the plot actually hinges on scientific issues.
The prime example of this is Marie Brennan's new series that begins with the novel A Natural History of Dragons. It's set in a vaguely Victorian world whose geopolitics are a lot like our own — except that there are several species of dragon, ranging from giant, poison-belching swamp wyrms to tiny dragonfly-like creatures. Our hero is a naturalist who studies these dragons, and makes a number of startling discoveries about their taxonomic relationships to each other, as well as their place in the environment. That's right — the main plot of these so-called fantasy novels is building a realistic taxonomy.
Biological accuracy has become a kind of secret subtext in a number of fantasy novels about dragons, actually, including Naomi Novik's Temeraire series and Anne McCaffrey's Pern books. Both authors try to imagine, realistically, the lifecycle of an entirely new species, including how they fit into their ecosystems and how they've been changed by domestication. You can easily read the Temeraire books as a chronicle of dragon-centric environmental science, with an enormous amount of commentary on how different breeds have been domesticated and why.
Similarly, Jeff VanderMeer's new Southern Reach Trilogy — billed as a kind of Cthulhu-esque fantasy — contain some of the most accurate and engaging descriptions I've ever read of transitional ecosystems. The entire series hinges on questions about what happens to animal and plant life in rapidly-changing environments. Plus, one of the main characters in the first novel is as realistic an environmental scientist as you'll find in any work of fiction.
One might argue that good worldbuilding in fantasy always involves hard science. Authors from N.K. Jemisin to George R.R. Martin and Ursula Le Guin have created alternate worlds whose geology, climate, and ecosystems are so good that they've captured the imaginations of scientists. These stories represent earnest attempts to create new environments based on what we know from studying the deep history of our own world.
Given what I already pointed out about how magic and advanced technology are basically indistinguishable in science fiction, we're going to have to admit that there's something other than magic that divides "fantasy" from "science fiction." It seems to be the kinds of science the two genres tackle. The hallmarks of rigorous science fantasy are a focus on Earth science, as well as biology and ecosystems. Science fiction, on the other hand, tends to focus on physics, cosmology, and engineering. Both genres often incorporate anthropology and political science.
I'm not naive, here — I realize that "fantasy" and "science fiction" are as much marketing terms as anything else. But as readers, we also use those terms common-sensically as a way of dividing up our stories into "plausible" (SF) and "purely imaginary" (fantasy).
Yet somehow, inexorably, plausibility has crept into our fantasy stories. We read truths about biological systems in fantasy novels that are absolutely ignored by science fiction writers. Of course there are SF authors who create realistic aliens, and many who write well-informed stories about near-term climate change. Those are the welcome exceptions. If you want good environmental science, fantasy is the genre these days that delivers.