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. 
Adult Nightmares: Causes and Treatments
 Psych Central
 American Journal of Medical Genetics
Nightmares: familial aggregation and association with psychiatric disorders in a nationwide twin cohort
1999, Volume: 88, No: 4, 329-336
 Mayo Clinic
 National Library of Medicine-National Institutes of Health
Nightmares: MedlinePlus Medical Encyclopedia http://www.nlm.nih.gov/medlineplus/ency/article/003209.htm
 American Family Physician, Pagel, JF
Nightmares and Disorders of Dreaming
Glossary of Terms
Genetics: The branch of biology that deals with heredity, especially the mechanisms of hereditary transmission and the variation of inherited characteristics among similar or related organisms.
The American Heritage Dictionary
Neurotransmitter: are the chemicals which allow the transmission of signals from one neuron to the next across synapses. They are also found at the axon endings of motor neurons, where they stimulate the muscle fibers. And they and their close relatives are produced by some glands such as the pituitary and the adrenal glands. In this chapter, we will review some of the most significant neurotransmitters.
Shippensburg University, Dr. C George Boeree
Sleep Apnea: a common disorder in which you have one or more pauses in breathing or shallow breaths while you sleep.
National Heart, Lung, and Blood Institute
Sleep Deprivation: A prolonged period without the usual amount of sleep.
“Some genetic and psychological factors can also lead to nightmares. About 7% of children who have nightmares have a family history of nightmares (their brother or sister or parents had nightmares).”
“The strongest genetic covariation was found in sleeptalking with sleepwalking, sleeptalking with bruxism, and in sleeptalking with nightmares. The estimated proportions of shared genetic effects were 50, 30, and 26%, respectively. The present results indicate that parasomnias share some common genetic background.”
Hublin, C. Parasomnias: co-occurrence and genetics, Psychiatric Genetics