The guidelines[1] that recommend NSAIDs also mention that exercise could help reduce or prevent the symptoms of menstrual cramps. However, those guidelines note that the evidence base isn’t that great for recommending exercise.
A meta-analysis of 10 trials involving 754 women was done to assess the efficacy of exercise for reducing menstrual cramps. The studies all involved either low-intensity exercise like yoga and stretching or high-intensity aerobic exercise like Zumba.[2] The main take-away is shown in the figure below.
While more evidence is certainly needed, and the quality of the existing evidence is low, exercise is a possibly worthwhile intervention since it has a lot of other, more well-established benefits while usually having few side effects.