This is also the case if you have a lot of money to spend on kitting yourself out for travelling. It's easy to think that, because of the bewildering array of technical and specialist travel-clothes available, normal clothes just aren't acceptable. This just isn't true. This is the case throughout the world, but particularly in Africa, the Middle East and Western Asia. For example, you won't be able to visit some places, particularly religious sites, if you're in shorts and this goes for men and women.
Some countries are stricter than others.
Many predominantly-Muslim countries have quite strict views about what is decent and what's not, especially for women. It's not all about religion though - get into remote areas, and you'll often find that people are just not happy about scantily clad tourists appearing, irrespective of their religious persuasion. This can often be surprising when locals are often themselves semi-dressed. There's nothing to be gained from it, and covering up when expected will make your life a lot easier. In any case, countries often have dress codes written into law, or regulation.