It's a little gross and does not make for appetizing reading.
Why is it there?
- Health - God wants to make sure people were healthy and do not get other people sick. People get asthma from mold. People spread leprosy by touch. God took precautions to quarantine and cleanse the problem.
- Sin - God used the infectious diseases to teach a lesson about sin. He did not want his people to be morally "sick" from the disease of sin that contaminates from the outside world.
- Personal holiness - God asked the people to take steps to make sure they were clean. It required obedience and awareness to their surroundings. They needed to pay attention to stay healthy.