I'd like to say, "No. Drugs are bad." But it really depends on how your mind works and what you're taking. I've written some of my best work, my one and only published work included, coming off pain medication from dental surgery.
It's not good to become dependent on a substance for writing. You'll develop bad writing habits and, worse, a possible addiction which could easily become more important to you than the writing.
If I know I'm going to be on medication that gets me, well, high, I make a point to write. I never risk anything illegal and don't plan to. I do, however, tend to get myself a drink before settling in to write. It relaxes me enough to just let the words flow rather than second guessing everything I type.
Just one drink though. Any more than that and my writing becomes a tad... questionable the next time I look it over.