It’s completely fine.
As long as you don’t have a medical reason to avoid intercourse it’s perfectly safe to have sex while pregnant It can even help during end of pregnancy to encourage labor/ soften your cervix I had sex up until it wasn’t comfortable for me anymore (around 36 weeks)
If your doctor says sex is okay then I’m sure this is okay!