Basically, Thoreau was jailed for an act of civil disobedience.
More specifically, Thoreau refused to pay a tax. He refused to pay this tax because he knew the proceeds would be used to fund a war that he opposed. By refusing to pay the tax, he was protesting (via civil disobedience) what he believed to be an unjust war. For not paying the tax, Thoreau was jailed.