This lining is where a fertilized egg would implant and set up shop, so your uterus is basically getting you all primed for pregnancy.
Of course, you don’t get pregnant every month, so the uterus sheds that lining and starts over with each new menstrual cycle. To shed the lining, the uterus contracts, squeezes, and pushes out the uterine lining, which you see as your period. Those contractions, which can range from a dull throbbing to an intense spasm, are what you feel as menstrual cramps.
MedlinePlus. (2016). Period pain.
Planned Parenthood. (n.d.). What is PMS (premenstrual syndrome)?