They know about your medication (see above).
What they may lack is the matching email address to your name?
They know about my meds because I pretty much have to tell someone to get the prescription filled.
They know my email address since the same people I go to to get the prescription filled have my email address so they can send me reminders that my refills are due.
So, the pharmacy has my prescription history going way back (what, you think I change pharmacies every time I get a new prescription) and my email address. And I still have never gotten any spam advertising drugs.
Note that drug advertising to me wouldn't actually do any good, since I'm not an MD, and am incapable of prescribing drugs to myself (or anyone else). That sort of thing is best aimed at doctors and hypochondriacs (the kind who will nag their doctors about the new drugs they see on TV that sound like they'd be PERFECT for their problems)....