And if anyone will not receive you... Here he speaks of those who do not receive: first, he teaches them what to do; secondly, what those will receive from God (v. 15). He says, therefore, if anyone will not receive you. He mentions two offenses: one is that they had not received them; the other is that they had not listened to the word of God which they had been sent to preach. Therefore, as you leave that house or town, because sometimes they were received in the town but not in any house, and sometimes not even in the town, as is recorded in the Acts of the Apostles. What, therefore, is to ...be done? Shake off the dust from your feet. This is exactly what Paul and Barnabas did (Acts 14:51). But why does the Lord command this? For dust clings to the feet; hence he ordered this to show them that they had made the labor of the journey useless. And this was to be punishment for them. As if to say: because of this you are deserving of damnation. Yet the Apostle says (Phil 2:16): "I have not labored in vain." Another reason is that the least one can have is dust; therefore, he wanted them to shake it off to signify that they would have nothing from them. The third reason is that by dust is signified temporal things, by the feet, affects, to signify that nothing temporal should remain in their affections. The fourth reason is mystical. The feet are their affections; for no matter how holy preachers are, it happens that their affections are stirred by some dust, either by vain glory, as it says in John (c. 13) that Jesus washed the disciples' feet and that he said: "He that is clean needs only to wash his feet, and he is wholly clean." Hence they needed to be washed for venial sins. And why did the Lord command this? To show that the preacher commits himself to danger. Hence if they do not believe him, it redounds to their damnation.
Source: Commentary on Matthew