Yes, and this is one area where a little preparation prevents real embarrassment. Religious sites carry the strictest rules almost universally: shoulders and knees covered for everyone, head coverings required for women in mosques and Sikh gurdwaras and for men in synagogues, shoes off in mosques, Hindu and Buddhist temples, and gurdwaras. Many major sites lend or rent cover-ups at the entrance, but carrying your own light scarf or sarong is smarter, and it doubles as sun or bus-chill protection.
Outside religious sites, standards track the country and even the neighbourhood. In conservative Muslim-majority countries and rural areas of South Asia, the Middle East, and parts of Africa, loose clothing covering shoulders and knees is expected of both genders, with women's dress attracting more scrutiny; beachwear belongs strictly on the beach. Cosmopolitan capitals are usually far more relaxed than the countryside of the same nation.
The practical formula: pack lightweight, breathable clothes that cover more rather than less, observe what locals your age wear and calibrate to that, and dress up rather than down for government offices. Modesty costs you nothing and buys warmth from locals everywhere; the reverse is not true.