Can someone please explain ?

Why don't doctors check for for certain things like herpes and HPV ? what if you have it and don't know it ? Doesn't that create a risk of harming the baby ?