Dehydration and mineral loss will cause muscle spasms.
Whether from being in a hot climate, exercising or both, excess sweating may occur and we lose salt. This salt is integral in maintaining normal nerve message transmission to the muscles. Loss of Magnesium and Calcium also affects the subtle balance of the nerve messages asking the muscles to contract and relax again resulting in muscle spasms / cramps. This is the most common cause of mineral loss.
There are also a wide range of medical conditions where mineral levels are low. We either fail to ingest them from the food we eat (malabsorption), or we fail to retain them when blood is filtered and cleaned by poorly functioning kidneys.
Certain medications, most commonly diuretics or ‘water tablets’, that encourage removal of excess water from the body, may cause the loss of precious minerals such as Na+ and Potassium K+, again resulting in poor muscle function, weakness and cramps.