The Fantasy and Science Fiction genres are distinct in several ways, but there is a certain degree of overlap as well. Both of them specialize not in things as they are but in things as they might be. They may differ in where the emphasis of the story goes — SF is notorious for typically making “the idea” and its consequences the point of the story, not necessarily the characters — but in this post I want to concentrate on what they have in common.
I’ve read SF&F all my life, and the two genres are cross-fertilized for me now. I like my SF best when it has moral characters as well as ideas, and I like my Fantasy best when its magical or supernatural elements are treated consistently, as though they were science.
It’s a truism in an SF story that you can change just one thing arbitrarily (time travel works, men live for centuries instead of decades, there are sapient aliens we can meet) and, if you can do an adequate handwave in the direction of scientific plausibility, the reader will accept it, as long as the notional basis is scientific (rational). For example, there may be religion in SF societies, and there may be powerful beings who seem to be indistinguishable from gods, but you can’t have real gods (supernatural entities) as agents in SF (though you can have a belief in them). That’s because god(s) may or may not exist, but science has nothing to say on the subject. That’s why they are literally “supernatural”, not “natural”.
What you must do in SF, however, is deal with the change consistently, e.g., if men live for centuries, there will be social and economic consequences. The story can be about those consequences, or they can be a background to the story, but they must be consistent, and a very great part of the pleasure of reading SF is the exploration of the consequences of such an idea.
Fantasy is a broader category. It accepts that those areas where it differs from quotidian reality may not be capable of rational explanation. Hence you can have supernatural entities (gods, elves, demons) as well as beings that might or might not be supernatural (vampires, werewolves, dragons).
It has always struck me that the treatment of the latter class has changed dramatically since they first made an appearance in the pages of fiction. Nowadays, authors are likely to delve deeply into the implications of, say, vampirism — how it first arose, exactly how it is transmitted, what the implications of it are for a fully-realized character — where originally they were content to treat vampires as inhuman monsters of supernatural origin, opposition to the true heroes of the story. In other words, “what if there were vampires” becomes the “change just one thing” of SF. The original idea in such a story might or might not be based on a handwave of scientific plausibility (vampirism as an infectious behavioral disease vs the result of a demonic curse), but it is based on something as a fixed point of origin and can then be explored as if it were a rational concept. “What if there were zombies” can be explored from both the zombie’s point of view as well as everyone else’s.
This sort of “what if there were X” subset of Fantasy has a lot in common with SF, even if the focus of the story is more likely on characters rather than idea. Regardless of the rational plausibility of the basic idea, the consistent working out of the consequences can be just as rigorous in either genre. There’s a term for this — it’s called the technology of magic.
In “technology of magic” stories, there are rules. Working magic has costs — it requires knowledge, energy, effort. You can get better at it. Elves are elves by birthright (you can’t become more elvish), but magicians can become better if they try. If the story is about a young person learning magic, his progression will be similar to that of an engineering or medical or other technical apprentice mastering his craft. If the same spell is done twice, and all preconditions are the same, the same results will ensue (experimental repeatability). In other words, given the existence of magic and magic practitioners, all else follows rationally.
That’s not to say that the rules are necessarily known to the inhabitants of these Fantasy worlds. For example, in my Hounds of Annwn series, the human protagonist has only a partial grasp on the workings of the fae otherworld where he now resides. In my Affinities of Magic series, the problem of “how the magic works” is a fundamental issue for my protagonist. In that series, the experimental discovery of the rules will cause immense changes to the culture, as if Tom Edison and the Industrial Revolution overlapped in time.