Yes! I've had this! In my right calf, it was horrible! And the muscle was sore a for a couple of days after that!
Drinking enough water should definitely help (and salt too, but that's not necessary if you don't really drink enough to begin with. Sports drinks often have some sort of salt added to them because when you exercise salt comes out with your sweat, and as you might know salt makes you retain water in your body, something which is often a problem as our diets nowadays often consist of too much salt, but if you exercise vigorously you will need some more salts in your diet than you otherwise will need. So I would say the first step for most of us mortals would be to just make sure we drink enough water

If that doesn't help then maybe try to add some salt to your food or something if you eat very little salt in your normal diet.)
I've only had a leg cramp once (and a half

Managed to stretch out my leg before it cramped properly) so far in this pregnancy and I'm trying to drink a bit more, but can't say I drink enough yet, so I'm probably just lucky I haven't had an other cramp.
Oh, and I think lying on your back can be part of the problem too as some veins will be "sqeezed" and the bloodflow to your legs will decrease. So that's another good reason to sleep on your side, if you don't already.