This is sort of an odd question, since presumably people walked around naked for tens of thousands of years before clothing became de rigueur. However, we know that as far back as classical antiquity, certain exhibitionist behaviors were socially frowned upon, although not necessarily punished. The philosopher Diogenes the Cynic (~400 BC) reputedly was fond of masturbating in public, to the horror and disapproval of his contemporaries. Being the clever fellow that he was, he would retort: "If only it were as easy to banish hunger by rubbing my belly."