The hospital in this case is a middle man, and their role is vouching for the doctors they hire. When you buy a propane tank at Home Depot, the reason it doesn't blow up is that Home Depot's reputation depends on selling non-explodey propane tanks. When you buy meat at Whole Foods, why are you sure it's not rotten? Because the government checked that specific steak, or because you know Whole Foods wouldn't sell you rotten meat? Similarly, the reason people go to reputable hospitals is precisely because they know they can trust those places to hire competent staff.
A purely free-market, reputation-based system of behavior works well for frequent events, but fails miserably for infrequent events, and that's why regulations are necessary.
In other words, and more snarkily, the assumption that Home Depot hires competent staff is probably not sufficient to protect you from explosion.
But there are cases where dangerous things aren't regulated by the government and it still works out pretty well, like roller coaster rides. In that case insurance companies actually play a big role in disseminating industry best practices.
In cases where companies produce danger for people other than their customers we shouldn't expect them to necessarily be responsible without government oversight - like with pollution. And in something like a hospital where people tend to die even when the hospital does everything right I wouldn't expect people to be able to differentiate between good and bad hospitals well enough - and the evidence I've seen is that people don't currently choose hospitals based on how good they are even with the government publishing statistics on the matter. I can easily imagine that in a totally unlicenced market the problem would be worse.