Pain in stomach

When I'm a sleep on a night I regularly wake up to switch sides and when I do I move to my left/ right side and my stomach has pain when I move but only when I change side?? Why ..?? 36 weeks pregnant