In short, 'No.'
Yogurt, in and of itself, is the product of milk with specific strains of bacteria that are not particularly unique. Yogurt is just as hospitable to harmful bacteria as beneficial bacteria.
The two mechanisms which spring to my mind that would prevent infection by harmful bacteria in yogurt would be the following:
*The already dominant beneficial bacteria outcompete for the harmful bacteria, effectively limiting the capacity for harmful bacterial growth.
*The already present beneficial bacteria create extracellular products which damage harmful bacteria.
The second, if it happens at all, doesn't happen on a scale that I'm aware of. The first could happen, but I highly doubt it. It seems, to me, that it would be more likely to happen in cheese when most of the easy resources have been consumed, which in yogurt they haven't.
Yogurt, and all products stemming from milk, are inherently safer not because of any bacteria that take up residence, but because the mammary glands inside the animal producing the milk are effective filters for a variety of infections. Milk is a product that is constructed in the mammary glands, and the cells are selective about the output. Keep in mind, however, that it is by no means sterile. There are dozens of virii and diseases which can be imparted by breastmilk, and nursing women must adhere to guidelines concerning exposure to medications and diet. It's also possible for DDT and other compounds to become concentrated in breastmilk, resulting in harm to the child.
So, yes, while milk in and of itself is safer than other options, it is not risk free. A virus could easily infect the mammal or herd producing the milk for sale to humans, and only exhibit dangerous symptoms after the milk had been sold. This is why it's illegal to sell unpasteurized milk for human consumption in most states.