Mary Shelley wrote Frankenstein in 1818. I wonder if most readers would consider the book within the science fiction genre. It certainly has claim to the Gothic and horror genres as well. If you do see it as belonging to science fiction, do you know of any earlier female science fiction writers? 1818 is very early, so there may not be any older female writers whose work could reasonably fit within science fiction, but I’m curious.
It depends on which works you consider to be science fiction. The most obvious candidate would be Mary Shelley, who, as you mentioned, wrote Frankenstein in 1818. She also wrote The Last Man in 1826, which by some accounts has an even stronger claim to being science fiction than Frankenstein does (thanks to Hypnosifl for this). But depending on how narrowly you define “science fiction,” there are a few other candidates.
And now, from Wikipedia1, here are some other female authors, up to the early 20th century:
I don’t know how to evaluate how close each of those works is to modern science fiction without reading them all, but I suspect that your answer will either be Margaret Cavendish or Mary Shelley, depending on where you draw the line between science fiction and proto-science fiction.
For further reading, see the Wikipedia article Women in speculative fiction, and the question What is the earliest work considered to be Science Fiction? on this site.
1 From Wikipedia’s articles on the timeline and history of science fiction.
As others have already pointed out, a lot here depends on how you define "science fiction".
For my nominees, the question would be whether you include writing about science that the author believed to be true, but has long since been shown to be almost pure nonsense.
For example, I'd include Arignote and Asclepigenia, who were Greek philosophers circa 500 BCC and 430 BC respectively. Each wrote about science, and didn't particularly intend that what she wrote would be false, but it turns out that essentially all of it was--and perhaps just as importantly, neither followed anything like the procedures that would now be recognized as how non-fiction about science is written.
Rather, she basically sat down, imagined how things might work, and wrote down what she imagined--as such, although intended as non-fiction, both the way it was written and the result fit pretty closely with what we'd now normally classify as fiction (and specifically, science fiction).
Adam Roberts’ book The History of Science Fiction (part of the Palgrave Histories of Literature series, published 2007) discusses Shelley’s Frankenstein more as an influence on the development of science fiction as opposed to the first science fiction novel. He says that the novel had an ‘enormous impact [...] upon the development of SF with Frankenstein.’ (p.95)
The first mention of a novel that Roberts deems actual science fiction is by Marie Corelli (1855-1924):
This is the first reference I can see in the text that refers to a novel as both science fictional and written by a female author.
Before that, there is one other reference in Roberts’ book: Cornelie Wouters, Baronee de Wasse’s work entitled Le Char Volant; ou, Voyage Dans la lune (The Flying Chariot, or Trip to the Moon), written in 1783. Roberts describes it as a ‘lunar fantasy’ and Wikipedia refers to it as a ‘philosophical tale’.