Rhesus negative blood

Hello!

I was wondering if anyone could help. I’m 16 weeks pregnant and been told I have Rhesus negative blood. I haven’t had sex since the day I got pregnant and was wondering if baby will be safe if I have sex as if I bleed I’ll need to get an anti d injection