So many weird old religious rules started out as trying to keep unenlightened but highly religious groups alive, fed, and disease-free, and somehow we've hung onto so much of it. For another example, check out the origin of sacred cows.
Clothes make the man. Naked people have little or no influence in society.