Here is from the Wikipedia entry on charley horses. There is a lot more, it's interesting.
____________
These muscle cramps can have many possible causes including hormonal imbalances, dehydration, low levels of potassium or calcium in the blood, side effects of medication, or, more seriously, diseases such as amyotrophic lateral sclerosis and neuropathy.
____________
It also mentions that they are often seen during pregnancy. I sure had them then.
I have heard that it can be caused by a lack of a certain mineral. Not sure but I think it might be potassium. Google "charleyhorse" and see what they say.