As SOON as they're able to understand! If that's toddlerhood, so be it!
I knew smoking was bad for you at age 7. My father became firmly hooked before the Surgeon General's warning. When my brother and I were kids, we used to try to get him to quit by hiding his cigarettes in the trash, but of course, all he had to do was buy another pack.
Regarding drugs, again when I was a kid, there was a public service announcement on TV (back in the 60s) where a bunch of teenagers were discussing drugs, and it would end with someone saying, "Why do you think they call it 'dope'?" "Dope" was the term used for drugs in those days. It also meant "a stupid person". So I got the message that way, too.
The earlier kids are taught about such matters, the more likely they'll have positive attitudes ingrained in them. They see it anyway, so why wait until they're 12 years old and suddenly start talking about it? Some kids experiment at younger ages than that, so it's best to educate them as early as possible.