Historically many people all over the world used alcohol to conserve drinks and make them safer to drink because they couldn't spoil as easily. However, when a Muslims strictly obeys Muslim religious laws (I think it's called the Sharia but I could be wrong), they are not allowed to drink alcohol.
That made me wonder how the Muslims of the middle ages and early modern ages (7th century-1850) made drinks that were safe for drinking for a longer time.
Thanks in advance for any answers.
Historically many people all over the world used alcohol to conserve drinks and make them safer to drink because they couldn't spoil as easily.
I'm afraid that you're starting from a very widespread misconception here; the Medieval Water Thing is much overstated in popular culture, as the VFAQ explains (Middle Ages, then Health & Hygiene, in case your browser doesn't take you directly there). You'll want the first two answers, by u/sunagainstgold and u/Qweniden. As you've expressed the Muslim Variation, an answer from u/CptBuck here addressing how desert civilisations do for water is also in order.