This account says that Thoreau's one night in jail was due to refusal to pay the poll tax because of slavery.
Other accounts mention his opposition to slavery as well as
"Polk's War"- the Mexican-American War which is eerily similar to the War on Iraq.
“Civil Disobedience” is an analysis of the individual’s relationship to the state that focuses on why men obey governmental law even when they believe it to be unjust. But “Civil Disobedience” is not an essay of abstract theory. It is Thoreau’s extremely personal response to being imprisoned for breaking the law. Because he detested slavery and because tax revenues contributed to the support of it, Thoreau decided to become a tax rebel. There were no income taxes and Thoreau did not own enough land to worry about property taxes; but there was the hated poll tax — a capital tax levied equally on all adults within a community.
Thoreau declined to pay the tax and so, in July 1846, he was arrested and jailed. He was supposed to remain in jail until a fine was paid which he also declined to pay. Without his knowledge or consent, however, relatives settled the “debt” and a disgruntled Thoreau was released after only one night.
Thoreau may have also brooded over the reaction of Emerson, who criticized the imprisonment as pointless.
According to some accounts, Emerson visited Thoreau in jail and asked, “Henry, what are you doing in there?”
Thoreau replied,
“Waldo, the question is what are you doing out there?” http://www.fff.org/freedom/fd0503e.asp