Sex while pregnant?!

I thought you can’t have sex while pregnant. But I always see stuff about people have sex while pregnant. Do you just have to do it differently or something?