Dehydration
Sweating profusely due to any activity or exercise can lead to dehydration, consequently causing muscle twitching. Especially in higher temperature, there is loss of sodium, potassium, and calcium from the body due to excessive sweating. The body cannot recover immediately from this, therefore, one experiences muscle spasms.