These lines are fairly straightforward. The narrator is puzzled by his neighbors claim that "good fences make good neighbors." He understands how this works if the had livestock. If they had cows or horses getting into each others' pastures or sheep mixing with a neighbor's cows, that could be a problem. But there is no obvious reason why orchards need to be fenced.
There are two metaphorical levels on which this operates. First, the farmer is referring to personal boundaries -- what in 21st century slang would be "giving each other space" or not being overly familiar. This reduces potential friction.
Second, the main activity and interest the narrator shares with his neighbor is repairing the wall -- and so mending the wall, and maintaining the fence, does, in fact, make them good neighbors.