It is conceivable that she heard the name of a ruined castle on the Rhine during the hurried trip that she, her half-sister Claire Clairmont, and Percy Bysshe Shelley took down that river in returning to England from the 1814 trip she memorialized in A History of a Six Weeks' Tour, a trip also quickly replicated in the third volume of Frankenstein (3.1.6). But this is unlikely, since none of the party spoke German, and Mary represents them as being rather standoffish to their fellow passengers during the trip.
Similarly, there is no documentary evidence of a visit to the Frankenstein Castle near Darmstadt. Indeed, had it happened, one would have expected it to have been noted either by P. B. Shelley in the Preface he wrote to the 1818 edition or by Mary Shelley herself in the retrospective history she penned for the Introduction in 1831. What the speculation has proven, however, is that the Frankenstein name is common enough not to have needed an actual prototype. The only real oddity about the family name, and one never broached in the text, is how so Germanic an appellation became attached to a French-speaking family in Switzerland.