My NIV Study Bible refers to the same account as recorded in Matthew 10:14:
“If anyone will not welcome you or listen to your words, shake the dust off your feet when you leave that home or town.”
The NIV notes make this comment:
A symbolic act practised by the Pharisees when they left an “unclean” Gentile area. Here [in Matthew 10:14] it represented an act of solemn warning to those who rejected God’s message.
It seems that the Pharisees had a tradition of shaking the dust off their feet when leaving an unclean place. There is a similar event recorded in Luke 9:5:
“If people do not welcome you, shake the dust off your feet when you leave their town, as a testimony against them.”
The NIV notes make this comment:
A sign of repudiation for their rejection of God’s message and a gesture showing separation from everything associated with the place.
Before Paul and Barnabas left Pisidian Antioch they shook the dust from their feet in protest against the Jewish community who had stirred up persecution against them and who expelled them from their region (Acts 13:50-51). The NIV Study Bible notes make this comment:
Paul and Barnabas did this to show the severance of responsibility and the repudiation of those who had rejected their message and had brought suffering to the servants of the Lord.
The only other similar reference I can find is when the prophet Nehemiah shook out the folds of his robe as a symbol of the solemnity of an oath and to reinforce the attendant curses that would follow should the oath be broken:
I also shook out the folds of my robe and said, “In this way may God shake out of his house and possessions every man who does not keep this promise. So may such a man be shaken out and emptied!” (Nehemiah 5:13)
There may not have been any O.T. law regarding shaking the dust off sandals when leaving an unclean place, but the symbol would not be lost on Jewish people. No curse may have been uttered but the gesture clearly demonstrated the disapproval of the person whose message had been rejected. It is one thing to reject the messengers of Jesus, but even worse to reject Jesus himself:
"I tell you, it will be more bearable for Sodom and Gomorrah on the day of judgment than for that town" (Matthew 10:15).
The NIV notes make this comment:
Although Sodom was so sinful that God destroyed it, the people who heard the message of Jesus and his disciples were even more accountable, because they had the gospel of the kingdom preached to them.
By rejecting Jesus’ messengers, who proclaimed the nearness of the Kingdom of God, they were effectively rejecting the gospel message, and so they would have to answer to God for their unbelief.
Edit: Regarding the question that Paul and Barnabas were not following the instructions passed on by Jesus but may have been following some Pharisaical tradition, the biblical evidence shows some marked differences between the actions of the Pharisees and the actions of Paul and Barnabas.
Jesus said he “was sent only to the lost sheep of the house of Israel” (Matthew 15:24) and his disciples took the gospel message to Jews. After Pentecost the gospel message was preached to the Gentiles. Had Paul and Barnabas been following some tradition of the Pharisees, they would not have returned to those places where the Jews had persecuted them and rejected the message. They did not place a curse on the towns from which they had been forcibly ejected. They came back to continue preaching the gospel, which was received by the Gentiles in those places, and they established churches and appointed elders.
"Later developments in Psidian Antioch followed the same pattern of acceptance and rejection... [re Acts 49:50]: "The expulsion of the missionaries was probably violent. It is confirmed by Paul's own later statement that Timothy knew all about his persecutions and suffering 'in Antioch, Iconium and Lystra'. The missionaries for their part shook the dust from their feet, a public protest against those who rejected the gospel, in accordance with the teaching of Jesus." (Source: "The Message of Acts" by John Stott, pp 227-8 - Inter-Varsity Press, 2000)
Paul and Barnabas were following Jesus’ instructions to shake the dust off their feet at the rejection of the gospel message by the Jews. It represented a warning of the danger to those who rejected God’s message. This had nothing to do with the Pharisees attitude towards Gentiles.