Yes, a number of medications can cause unusual and/or vivid dreams and nightmares. Some antidepressants, like Prozac, as @gailcalled mentioned, and also nicotine patches, as @Lightlyseared mentioned. I can attest to that one from personal experience. Also, vivid, unusual dreams are a common, though not universal, side-effect of Chantix, a smoking cessation drug.
I had to stop using the nicotine patch because I was having these incredibly odd, complex, weird and extremely vivid dreams every night. I generally have fairly strange, complicated dreams anyway, but when I was using the nicotine patch sleeping was, for me, like spending 8 hours at “Dali World”, as in Salvador Dali. And as fun as that might sound to some people, when the surrealist theme park is located inside your own head it can be a little unnerving. When I woke up in the morning I was mentally exhausted and it took several minutes to get my head back on straight and get readjusted to reality.
That is one of the reasons I have been reluctant to try Chantix to quit smoking. As this guy mentions in his description of dreaming while on Chantix, the dreams I had on the patch seemed so incredibly real. That’s one of the reasons it took time to get my head back on straight when I woke up. It took me a while to realize that I had actually just been dreaming, rather than living the things I had dreamed about.
The only dream that I remember from “the patch dreams,” and it is one of the milder, simpler ones, seemed so real and was so vivid. The dream started with me waking up, getting out bed, walking down the hall to the kitchen so I could make my morning pot of coffee and I went to the back door and drew back the curtains to look out the window. This is exactly what I do first thing every morning. I go to the kitchen look out the window of the back door first, to see what kind of day it is, sunny, cloudy, rainy, whatever. Then I make my coffee. I had no idea I was dreaming and when I looked out the back window I saw that over the course of the night, a number of large tomato vines had grown all over and across my backyard. And the tomatoes were huge; the size of boulders, and they were so incredibly big, and so incredibly red and the grass was so incredibly green and the sky was so incredibly blue! My reaction was a little surprise, to see those big tomatoes all over my yard, and I was slightly perplexed as to how that kind of growth could have happened so quickly. But other than that, it didn’t seem that strange.