I get those occasionally when I have over stressed my leg (always my right leg, for some reason). I mentioned it to my doctor once, but she kind of ignored me about it - I think it has to be happening on a consistent basis and interrupting your sleep before they take a patient seriously, or maybe it was just that doctor (or the way I was explaining it). Probably when the ex husband was around I should have made him go in and explain what was happening - I woke him up a lot of times screaming in pain and one of the few kindnesses he ever did me was to help get that spasm to stop. Years ago it would be so bad that I would stay in a cramp for days, and couldn't get the muscle to relax at all, actually walking with one leg en pointe - that was when I was quite a bit out of shape, though. Didn't go to the doctor then, but probably I should have. Now I can usually manage to wrestle my leg out of bed and once I walk around its better but the sensation can last a long time - sometimes the muscle stays cramped, I can actually feel an indent in my leg where it has pulled back.
If I sense one coming on, if I can pull my foot back and up so toes are in general pointing towards my head, I can sometimes pull out of the on-coming attack. Or alternatively jump out of bed and walk as soon as I feel it rushing at me and that minimizes the after effects. If I stay supine and try to ride it out, its agonizing and likely to just happen again later in the night. I never let my toes point, because that will bring on a spasm.
Sometimes stretching the calf muscles can help prior to going to bed. Also sometimes there is a dehydration issue or mineral depletion issue - these are best discussed with the doctor, though to make sure that is what is going on. As Dussel mentioned, Quinine is an option, plus there are a few other things too on the market now or other preventatives , depending on what a doctor and you decide on to be the root cause.
_________________
People think there are four elements to the world; fire, wind, water and earth. They are wrong. There is a 5th element - surprise. - paraphrasing of Terry Pratchett "The Truth"