What causes a Charlie Horse and how to prevent it?

Once in a blue moon I get what my mother says is a Charlie Horse. It's an EXCRUCIATING pain in my calf muscle that I only get while sleeping. Just the other night I was awoken in the middle of my sleep with this pain. It hurts so freaking badly.

So what causes a Charlie Horse?
Also, how can I prevent it?
8 answers 8