Thanks for the query.
Prolonged sleeping or sitting in one position can cause swelling of the dependent position and some amount of physiological edema is common in pregnancy
But as you are having pain, better to consult gynecologist once.
After consulting go for physical examination to rule out the possibility of the premature labor
and also get blood parameters checked to rule out the possibility of any thrombosis