Dress code when visiting Roman Catholic, Orthodox or Formal churches
The biblical principle is that flesh should be covered, that is why priests, monks and nuns cover as much up as possible. This is also why devout women wear head coverings or hats, to cover their beautiful hair so as not to draw attention to themselves.
In these surroundings, short skirts, shorts, bare arms, bare shoulders, cleavage etc scream out Look at Me!
And show a great disrespect to the feelings and beliefs of the worshippers, just like strolling through a mosque in a swimsuit and eating a pork pie.
There is often no law governing these things, but it reflects badly on you and determines the type of reception that you can expect if you want something from them - like a photo or directions to some other place.
And yes, you could be barred from entering a church for any reason, as they are not public rights of way.