1590s, from earth + worm (n.). In this sense Old English had eorðmata, also regnwyrm, literally "rain-worm." Old English also had angel-twæcce "earthworm used as bait," with second element from root of twitch, sometimes used in medieval times as a medicament.
For the blake Jawndes take angylltwacches, er þei go in to the erth in the mornynge and fry hem. Take ix or x small angyltwacches, and bray hem, and giff the syke to drynke fastynge, with stale ale, but loke þat thei bene grounden so small that þe syke may nat se, ne witt what it is, for lothynge. [Book of Medical Recipes in Medical Society of London Library, c.1450]