I think much of what you see in Leviticus and Deuteronomy were geared toward governing a nation of people that were in the wilderness for much of that time. Sanitary issues would have been a major concern.
obviously they were in the wilderness for 40 years- they were over 1500 years leading up to the Common Era and the 1st century when the Jews lost their temple and that form of worship.
Look at the Nations that surrounded Israel and the hygiene of people in general at that time. There was no way they knew about the microbe and how disease is transmitted. There was no real refrigeration then either so this issue of sanitation as an entire nation is quite interesting and how was it made part of the law. They had to wash before eating, urinate and defecate outside the camp and when living indoors they were instructed to go into the field and dig a hole.... There were restrictions on the types of foods they were allowed to eat and in the wilderness this mattered little since all there was to eat was manna.
Here is a good question. The Jews lived to be 70 and 80 as Psalm 90:10 states. And the life expectancy of all other men (in general ) leading into the modern era was 40-50 and still is in underdeveloped nations. Why...? Simple hygiene and laws that governed sexual practices, an other things. Modern medicine with all its fantastic discovery is pushing the needle no doubt,but it is hygienic practices, plain and simple that is the big one. Bathing and washing and simple stuff like that is normal today, but not then and not even until the 19th century. It was a common practice for people to poop in a bowl and throw it out the window right into the street not so long ago.... Metropolitan life up to the 17th and 18th century was very dirty and back in 1500 BCE we can only imagine the medicine and hygiene....yikes.
So who knew about microbes in Israel? Moses wrote the 1st 5 books of the Bible and he had no microscope.... For me this just adds weight to the idea that Moses was inspired to write the laws as the were far superior to mans knowledge and with respect to sanitation... wow, And not so far fetched as some believe. A bit like a secretary takes notes for her boss....she writes but it is really the thoughts of the boss that lands on paper. The life expectancy is what 78? Interesting.