Same thing happened to me when I had it two weeks back. It continued to hurt my belly and lower back for the whole night and next day. It was just like period pain. I am so afraid that I didn't attempt for it again since then. What I have been told is that could be contractions as the body prepares itself for labor.
I am 36 weeks today.
Sex doesnt hurt the baby, but your hubby could've hit your cervix which will cause you some pain, or sex can trigger contractions.
Call your DR bc you might funnel. Better safe then sorry