During last summer's vacation through SE Asia we made several stops that required "special" clothes. Not only were no shoes allowed (something we were familiar with from our Malaysian trip), but everyone was required to wear long pants (and spandex did not count) and shirts with sleeves, and to leave their cameras in a locked box outside. In one place we were patted down to be certain we didn't try to sneak in a cell phone. Finally everyone needed to speak in a whisper. Having read ahead we were prepared with long pants for my husband and dresses and skirts for the girls and I. Less experienced tourists were offered wrap dresses or large linen pants to cover up with.
So what's with a dress code for tourists? Well it's simple. In those countries and cultures, removing shoes and hats, not pointing the camera about, and wearing modest clothing is a way to signal respect.