Hurting during sex?

Kayleigh
Me and my boyfriend have had sex for over a year and a half and it's been normally but a couple months ago I started to have a very bad sharp pain in my lower stomach and sides very very badly. It don't happen all the time but it does some. What could be causing this?