There are lots of things that could cause this. Because the nerves that feed the legs exit the lower back in one area a nerve impingement there, possibly caused by sleeping in a strange position, can cause pain in the leg.
If this is similar to a big muscle cramp you might try drinking more fluids at night and see if that helps. There's really no telling until you see a doctor and get it checked out. Good luck!
We hope you find this general health information helpful. Please note however, that this Q&A is meant to support not replace the professional medical advice you receive from your doctor. No information in the Answers above is intended to diagnose or treat any condition. The views expressed in the Answers above belong to the individuals who posted them and do not necessarily reflect the views of Remedy Health Media. Remedy Health Media does not review or edit content posted by our community members, but reserves the right to remove any material it deems inappropriate.