Menstrual cramps (Dysmenorrhea) can happen because of severe contractions in the uterus. If the muscle contracts too strongly during your menstrual cycle, it can press against nearby blood vessels. This briefly cuts off the supply of oxygen to the uterus. It’s this lack of oxygen causes pain and cramping.
The heat from a bath, hot water bottle or massage will help bring blood back to area which reduces the cramping. Massaging the lower back and abdomen will also help the muscles involved to recover more quickly.