The primary cause of dysmenorrhea is the increased production of prostaglandins, which are hormone-like substances that cause the uterus to contract. These contractions can lead to decreased blood flow to the uterine muscle, resulting in pain. Factors such as stress, anxiety, and a family history of dysmenorrhea can also contribute to the severity of symptoms.