When they persecute you in one town, flee to another. In the beginning of this section he mentioned the dangers, when he said, behold, I send you... Here he teaches how they should behave. This is divided into two parts: first, he teaches them to beware of evils and dangers as to prudence; secondly, to maintain equanimity in dangers (v. 26).
In regard to the first: first, he teaches them to avoid bodily danger; secondly, spiritual (v. 24).
He says, therefore: I have said that he who perseveres to the end will be saved, but that is no reason to expose yourselves to danger; rather, when they p...ersecute you in one town, flee to another. This is expedient for the weak, lest they fail by exposing themselves carelessly: "A wise man is cautious and turns away from evil, but a fool throws off restraint and is careless" (Pr 14:16). Likewise, it is for the perfect; and if not for their sake, then for the salvation of others, as it says in Philippians (1:24): "But to remain in the flesh is necessary for your sake." The Lord showed this when he fled into Egypt on account of Herod, as is recorded above (2:14). The apostles also did this, as in Acts (8:1). But John (10:12) seems not to agree with this: "The hireling flees and leaves the sheep." Therefore, it seems that this refers not to them but to hirelings. Augustine says that persecution threatens either one person, and then he should depart and leave others through whom salvation can be achieved; or it threatens the whole Church and then it is necessary for the entire Church to flee to safer places, as has already happened, or some should flee and others hold their ground, or the shepherd remain with his flock. He continues: I say to you, you will not have gone through all the towns of Israel, before the Son of man comes.
Then he answers a tacit objection, for they could say: You are sending us to Judea; if they chase us out, where shall we go? I say, granting that they expel you from one city, flee to another, and you will not be able to traverse the cities of Judea, before the Son of man comes, i.e., until he rises from the dead, and then he will send you to the gentiles, as it says below (28:19): "Go, teach all nations." Hilary explains it another way, namely, that he is speaking of the second mission, when he says, when they persecute you..., i.e., flee from the Jews to the gentiles, as it says in Acts (13:46): "It was necessary that the word of God be spoken first to you. Since you thrust it from you and judge yourselves unworthy, behold we turn to the gentiles." Mystically in this way: When the heretics persecute you with their texts, refute them with texts; for they will not be finished, until the truth is manifested.
Source: Commentary on Matthew