In 1831, Mary Shelley recalled the summer at Lake Geneva, and wrote that
Many and long were the conversations between Lord Byron and Shelley, to which I was a devout but nearly silent listener. …Various philosophical doctrines were discussed, and among others the nature of the principle of life, and whether there was any probability of its ever being discovered… Perhaps a corpse would be re-animated; galvanism had given token of such things: perhaps the component parts of a creature might be manufactured, brought together, and endued with vital warmth.
Why were they thinking of these things? Here are couple of articles that explain what was going on in the world of science in the early 19th century:
The Real Science Behind Frankenstein