Really need advice right now..

So I am 21 weeks pregnant and on my first prenatal visit they did the standard std testing. Everything came back negative which was good. Well a few weeks ago I got a call from my ex husband saying he tested positive for HSV1 and said I should get re tested. So at my last visit I mentioned this to my doctor and she said I tested negative but she will do a full std panel re test. I just got my results back and I tested positive for HSV2??? I don't understand how this is possible as I have never had any symptoms or an outbreak in my whole life. How can he test positive for one type and I test positive for the other? Plus why was the first test negative and the second positive? I'm so stressed out and feel ashamed. They said they will write me a prescription for valtrex that I will have to take every day starting at 36 weeks so I don't have an outbreak and pass it along to the baby. Just really need some advice right now