This quote is from Good Manners in A Nut Shell by Sally (Hines) Bradbeary, published date: 1941,
Q: Would a person be considered impolite to refuse to conform with conventions in whatever place or country he is visiting or living?
A: Yes! There is nobody more displeasing than a person who is obstinate in his conduct and not willing to change his ways just because the conventions of a community are not the practices he has been used to. One is always conspicuous who appears indifferent toward observing local customs, and his friends are ashamed of him. Convention has to do with a situation like the following: In Mexico when the women attend church at the old cathedrals, they always have their heads covered; but numbers of foreign women wander through the chapels and the churches hatless. This is thoughtless, of course, but certainly shows lack of respect for the natives and their religion.
….Observing conventions and rules of etiquette makes one a pleasant and polite person.
The author clearly shows the contemporary practice of Hat=Covering. The Mexican ladies probably wore lace mantillas or some other fabric covering, like their shawls pulled up over their heads. (Or perhaps, the higher class ladies wore hats, too?)
Another cultural aspect of the quote is pointing out the dichotomy tourists make between destination and actual place where people live. If the same foreign women had gone to church in the U.S. or Europe, they would most likely have worn their hats. An old cathedral in Mexico is a destination, a stop along the tour, not a sacred place where real people worship God.