Are Nightmares Hereditary?
Nightmares can be hereditary.
More Info: If you suffer from chronic nightmares and the common catalysts, such as stress and medications, have been ruled out, you may have a distinct nightmare sleep disorder. A nightmare sleep disorder is more common in people who have relatives that suffer from the condition. 
What Is a Nightmare Disorder?
Nightmares are common, especially in children, and usually reflect nothing more than fear or stress. For those that suffer from frequent nightmares, nightmare disorder may be present. According to the Diagnostic and Statistical Manual of Mental Disorders, a nightmare disorder is indicated in the absence of the presence of another mental disorder, such as post-traumatic stress disorder, effects of a substance, such as antidepressants or narcotics, or a general medical condition. 
Genetics May Play a Role in Nightmare Disorder
One study that investigated the role that genetics plays in incidence of nightmares found that genetics was a factor. Analyzing sets of twins, the researchers concluded that genetics was a factor in 47% of the cases with children, and 37% of the adults. In both cases, those suffering frequent nightmares had a higher likelihood of an underlying psychiatric disorder. 
Common Nightmare Catalysts More Likely
There are such a wide variety of factors that can cause nightmares, it is more likely that something other than genetics is the culprit. Stress is a common nightmare catalyst especially if the stress is induced by a major traumatic event such as the death or illness of a loved one.
Additional nightmare causes include medications, both prescription and illicit, alcohol consumption as well as alcohol withdrawal, and sleep disorders such as sleep deprivation and sleep apnea. 
Could Your Sleep Aid Be the Blame?
Ironically, the very thing that you take to remedy your sleepless nights may just be the cause. One side effect of many sleep aids is nightmares. Prescription medications could also prompt nightmares. Alcohol consumption is another possible nightmare catalyst, so that glass of wine to help you sleep may just be causing the problem. 
Medications Associated with Nightmares
Several medications have nightmares listed as a side effect and include:
Drugs that alter neurotransmitter levels that are associated with nightmares are alpha agonists, beta blockers, levodopa, monoamine oxidase inhibitors, rauwolfia alkaloids, selegiline, and tricyclic. Drugs with withdrawal effects that are associated with nightmares are barbiturates, benzodiazepines, and ethanol. Additional drugs associated with nightmares are flutamide, ketamine, procarbazine, and short-acting barbiturates.  Any illegal substance is associated with nightmares.