וְגֵ֖ר לֹ֣א תִלְחָ֑ץ וְאַתֶּ֗ם יְדַעְתֶּם֙ אֶת־נֶ֣פֶשׁ הַגֵּ֔ר כִּֽי־גֵרִ֥ים הֱיִיתֶ֖ם בְּאֶ֥רֶץ מִצְרָֽיִם׃
И чужеземца не притесняй; ибо вы знаете сердце незнакомца, видя, что вы были странниками в земле Египетской.
Rashi on Exodus
וגר לא תלחץ AND THOU SHALT NOT OPPRESS THE STRANGER — In numerous passages (36 in number) does the Torah offer a caution about the ill-treatment of the stranger, because his original character is bad (Bava Metzia 59b).
Or HaChaim on Exodus
ואתם ידעתם את נפש הגר, "and you are familiar with the way a stranger feels." Compare what I have written on 22,20 "you must not disadvantage the stranger." The present verse is proof of the truth of what I have written there.
Siftei Chakhamim
Because סורו is bad. Some explain סורו as שְׂאוֹר (leaven), referring to his evil inclination — which is strong and bad, thus the stranger is easy to tempt [away from the path of the Torah]. Others explain [ סורו as סָר (stray). This means that] once he strays from the path [of the Torah], he cannot be [easily] persuaded to return.