Visiting a persons home for the first time is a voyage into the unknown. Some homes are kept magnificently clean while others are left appalingly dirty.
When invited, you should ask, 'is your home clean?' Do you have pets?, etc. You can always validate this question by adding that you have allergies to dust or pet fur, or even dirty people. Only a dirty or stupid person will be offended by this question, whereas a clean person will chuckle and assure you that their home is clean and probably ask, 'are you?'. Either way, you'll have properly qualified them (and they, you) before making a commitment, and in doing so, prevent an unpleasant experience.
Where a person takes pride in their home and keeps it clean, including their floors, it should be immediately apparent to you when entering it. They have every right to insist that you remove your shoes when entering. This is their inner sanctum. In fact, they shouldn't have to ask. You should immediately make motion to remove your shoes. If they insist that it is not necessary, then keep them on. The fact that you have been invited to someones home is an honour for you and for them to receive you. The onus is on you to respect their ways when in their home. The onus on a host would be to invite you into a healthy and comfortable environment and, as per Wil's perfect suggestion; that the host offer you complimentary slippers, etc.
If you are asked to remove your shoes in a clean home and you don't like it, it means your either a dirty varmant with stinky feet or an arrogant ass with no respect for yourself or others.
If you are a clean person yet allowed to keep your shoes on in someones home, it means they are dirty varmants and you should run or brass it out that one time and never return.
There are seriously legitimate concerns at hand here. God only knows what lays in the ground we walk on. Spit, urine, feces (human, animal or fowl), blood, chemicals, remains of rotten food or dead bodies (human or otherwise), dangerous microbes, insects, etc provide a minefield of potential health risks. Why anyone would track this into their homes or allow others to do so, is and will always be, beyond my understanding.