Towns and cities would keep clean water sources as an attraction for the business of passing pilgrims/merchants. And for themselves, because even Middle Easterners need water to live.
Worst case, people boiled their drinking water if they knew their water source was polluted. They didn’t understand germ theory, but they knew this made water safer.
Non-Muslims might produce beer, which would be safer since it’s technically pasteurized. But no one was drinking wine or beer as regular hydration. That’s a tired old myth.
Latest Answers