I only experience this when I am pointing my toes very hard while practicing a layback spin while figure skating. After years and years, this is the only time it happens. I have been lucky it has never happened during a competition which leads me to believe that in my case, it's a symptom of overuse.
It is the weirdest feeling and very uncomfortable but I have experienced much greater pain. I usually end up limping off the ice to massage it for 2 or 3 minutes and then I go right back at it. Overuse or improper use can cause your muscles to contract but water, vitamin, or mineral deficiencies can cause it as well.