Yes, water was unsafe. A lot of it was contaminated with sewage, especially near farms or populations. Boiling it during the brew would have made the water “safe” to drink, but keep in mind, that only kills the bacteria in the sewage, boiling does not actually purify. Fermentation, might let some stuff settle-out.
What do we tell the noobs? “If your water is good to drink, it’s good to make beer..” well, the reverse is true too. Any specialty grains and hops would have barely covered up.