Imbalances in the endocannabinoid system can contribute to diseases and conditions that cause leg cramps and spasms to occur more often. In addition, the endocannabinoid system is responsible for regulating inflammation and pain, which is why when we consume cannabis and cannabidiol (CBD), it helps to relieve symptoms of several conditions including leg cramps.
Source: https://cannabisworld.biz/2022/06/30/can-cannabis-help-with-leg-cramps-and-muscle-spasms/