Herpes

Hello ladies , I have a question about herpes

Today I was diagnosed with it but I haven’t had sex outside my marriage , how come I have this sti? Can I develop this by my own? I’m not sure if my husband have it , and if so should I worry?

I been married for 21 years and I never had this before !