Unprotected sex

When are you suppose to stop having unprotected sex in pregnancy? I heard it can lead to labor or pre term labor. I'm 26 weeks. Just curious if you even have to stop having unprotected sex.