If your brother does not live near you, or if you do not know who he is, you are to take the animal home to remain with you until your brother comes seeking it; then you can return it to him.
The kindness that was commanded to be shown in reference to an enemy (Exo 23:4, etc.) is here required to be much more done for a neighbour, though he were not an Israelite, for the law is consonant to natural equity. 1. That strayed cattle should be brought back, either to the owner or to the pasture out of which they had gone astray, Deu 22:1, Deu 22:2.
Commenting on Deuteronomy 22:1-4
And if thy brother be not nigh unto thee,.... Does not live in the same neighbourhood, but at some considerable distance; so that he cannot soon and easily be informed of his cattle, or they be sent to him: or if thou know him not; the owner of them, what is his name, or where he lives: then thou shall bring it into thine house...
And if thy brother [be] not nigh unto thee, or if thou know him not, then thou shalt bring it unto thine own house, and it shall be with thee until thy brother seek after it, and thou shalt restore it to him again. (b) Showing that brotherly affection must be shown, not only to those who dwell near to us, but also to those who are far off.