When Thoreau says, "i have found that no exertion of the legs can bring two minds much nearer to one another," he means that physical closeness doesn't guarantee intellectual or spiritual closeness.
Thoreau has expressed this riddle of the distance involved in being solitary in "Economy" and will express it again in "Visitors." He points out that no amount of walking can bring people together, deliberately confusing "close physical proximity" with "agreeing with one another."