This myth again? You don't even need to know medieval history to figure out it is bullshit.
Think about it logically, you can not brew bear from water that is contaminated in the first place. Garbage in garbage out. If you have a safe water source, well just drink water. Also, we are talking about medieval beer with maybe 2 percent alcohol, how the hell is that going to help? That percentage is way too low to do any good.
Obviously people were mostly drinking water. I mean think of all the calories, the logistics and all. It is true though that households would brew their own bear for consumption. Export of bear would develop in the late medieval period. It is also true, that weak 2% ale was consumed a lot, just not as much a water.
I guess people just really like the idea of medieval people being shitfaced all the time.
Edd: Also most places where not very densely populated, even cities were not compared to modern time. So while water safety was a concern, it was not as big as one might think.