Where and why societies developed such a fear of nudity is locked in the mists of the distant past but for sure the Abrahamic religions had a lot to do with it in the west since the dawn of the current era.
Leaving aside the protective issue (keeping warm and other environmental factors) clothing seems to have begun as a status statement. Going back to the early civilisations even Egyptian pharaohs don't appear to have worried too much about covering up, but assorted clothing-type adornments would be worn to demonstrate position in society. Egyptian slaves were naked, so even rudimentary clothing would be a mark of one's standing in society.
Once status got in on the act, it was probably a short journey to fashion moving in delineating the strata of social classes. And aside from environmental protection, so much of clothing to this day revolves around being fashionable and wearing not just clothes but "the right" clothes. Yes, society affords covering-up a moral dimension, but once it's taken for granted that normality is clothed the real power is in the hands of the fashionistas.
Of course the religious angle centres on sex. A monotheistic religion requires a complete focus on the god; since the procreative impulse is the human's strongest urge it must be tamed by hiding temptation and covering everything with cloth. This continues in some religions with the requirement for women, in particular, to be completely hidden lest men lose control of their desires!