Mechanically, cramps are like labor pains. Often, after several years of menstruating or after childbirth, the cervical opening enlarges. The uterus doesn't have to contract as much to discharge the menstrual flow, so there is less cramping. Menstrual pain may also come from the bleeding process itself. When the uterine lining separates from the wall, it releases chemicals called prostaglandins.
Prostaglandins cause blood vessels to narrow, impeding the supply of oxygen to the uterus.
Just as the pain of a heart attack comes from insufficient blood to the muscles of the heart, too little blood to the uterine muscle might cause the pain of menstrual cramps. Menstrual pain can have other causes including tumors, fallopian tube infection, and endometriosis, a condition in which fragments of the lining of the uterus become embedded elsewhere in the body. Sometimes, simple measures are all that's needed to feel better. Cutting down on salt might help reduce fluid buildup, and support hose may alleviate swelling in the legs or ankles. Extra rest or sleep is one way to deal with fatigue, and using a heating pad or hot water bottle eases cramps for some.