To what extent do ethics and morality operate in the law of Thoreau's time?
Ethics and morality certainly operated in the law in Thoreau's time much more than they do in the twenty-first century. However, that is not to say that there were not unethical politicians and government workers and attorneys and laws that were immoral.
A contemporary of Henry David Thoreau, Ralph Waldo Emerson, wrote in his essay entitled "Self-Reliance,"
Society everywhere is in conspiracy against the manhood of every one of its members. Society is a joint-stock company in which the members agree for the better securing of his bread to each shareholder, to surrender the liberty and culture of the eater.
In July 1846, Thoreau was arrested and spent a night in jail because he had refused to pay a poll tax to the state of Massachusetts since 1842. He was convinced that this tax supported the Mexican-American war as well as the expansion of slavery into the Southwest, two issues to which he was ethically and morally opposed. Therefore, Thoreau felt that he had a moral and ethical right to refuse payment of such the poll tax, so he chose to spend the night in jail. Later, he wrote his famous essay "Resistance to Civil Government" because he did not support the war.
In this essay, Thoreau states that he would willingly obey those who are honorable, but he declares that many men are unethical, serving the state, not as men, but as "machines" with their bodies. He writes,
I please myself with imagining a State at last which can afford to be just to all men, and to treat the individual with respect as a neighbor.
In his allusion to the existence of slavery Thoreau clearly indicates that he finds it morally reprehensible; in fact he wrote that it does not become a man to believe in the American government without disgracing himself. Thoreau and Emerson, however, stand as examples of ethical and moral men.