Historically the notions of cleanliness and health are
excpetionally strongly aligned with virtue, and filth, disease, ugliness, and disability with sin or evil. This appears across a large range of Eurasian cultures that I'm aware of, and quite probably even more widely elsewhere (though I'm less aware of those).
Even such attributes as handedness can be ascribed to virtue or sin, as with, well, sinister, literally, "of the left side", but with the evolved sense of "prompted by malice or ill-will". See: <https://www.etymonline.com/word/sinister>
(And apparently "sinister" and "sin" are not related, though that possibility had occurred to me whilst writing this.)
The same concept often extended to medicine and medical practice, and it wasn't until the emergence of germ theory of infectious disease that medical knowledge and practice began to emerge from its moralising of pathology to a general understanding of disease and dysfunction as being organic in nature. That shift is still incomplete, and there are places, institutions, individuals, and conditions in which moralisation remains a too-common occurance (obesity, addiction, sexually-transmitted diseases, and mental health most especially). We also see moralisation of pathology in other contexts, most notably in criminal law and politics.