What Thoreau says is that a man who does not keep pace with his companions may be marching to the beat of a different drummer.
If a man does not keep pace with his companions, perhaps it is because he hears a different drummer.
When he says this, what he means is that a person who acts in a "strange" way may just have different values than the rest of society -- they are acting in the way that their values tell them is right.
This is one of the major ideas of Transcendentalism. This was a philosophical movement that Thoreau was a part of. They believed that people should always act according to their consciences and not according to what society said they should do.
Henry David Thoreau was himself a man who "marched to the beat of a different drummer." For him, and for the other Transcendentalists, individualism was of paramount important. Another Transcendentalist, Ralph Waldo Emerson reiterates this precept of individualism in his line,
Do not go where the path may lead, go instead where there is no path and leave a trail.
Like Emerson, Thoreau emphasized the importance of nonconformity if one would be an individualist. When he goes into the woods to live, as he describes in Walden, Thoreau observes that people who have fewer possessions have more freedom because they are not bound to care for what they own. Instead, they can travel more easily, and need not worry about anything.
The individual may more easily communicate with Nature, as well, intuitively experiencing it at his own pace. In Chapter 8, "The Village," Thoreau writes that he enjoyed a small amount of gossip, but too much "numbed the soul." On one visit to town, he was incarcerated for refusing to pay taxes, protesting because of his position on slavery.
Thoreau was a die hard individualist who consciously strove to stand apart from the crowd. Thoreau’s individualism was a way of life more than it was a political outlook. His ideas on individualism have had a lasting influence on humanity, but as for Thoreau himself the way he lived his own life was more important than the manner in which he influenced the world. Thoreau developed a philosophy around his own way of living. It was in pursuit of this philosophy of life that he went to live in a secluded cabin on the shore of Walden Pond for two years, and to make a legendary stand in defence of individual conscience by refusing to pay poll-tax for which he was arrested in 1846. He believed that if he paid his tax he would be actively supporting negro slavery and the conduct of the Mexican war. By doing so, he was demonstrating his right to withdraw consent from policy that he regarded as unjust.
It was in this manner that he marched at a different pace than his other fellow countrymen who paid taxes regularly.