Is this normal?

Ac

So I've had bowel issues before I was pregnant, just runs in my family, and when I got pregnant I was on the toilet constantly. Im around 6 weeks and im still like it but not as bad, last night I had alot of gas but couldn't go toilet. This morning I really then needed to go, so I went and as I let it out I got the sharpest pains go right through my whole stomach and like uterus area... is this safe? Is this normal? Or could that of harmed baby? First pregnancy and im so scared of the worst!