A Democrat since childhood, Palmer was elected probate justice of the peace in 1843. He was subsequently elected as a delegate to the state constitutional convention in 1847, county judge in 1848, and state senator in 1852. During his successful campaign for reelection to the senate in 1854, he exhibited an independence that would mark the remainder of his career. Rebuffing pressure from Democrats to support the Douglas policy on slavery in Kansas and Nebraska, Palmer ran instead as an Anti-Nebraska Democrat. This ended his friendship with Douglas and presaged an equally stormy sixteen-year Republican affiliation. In 1856 he presided at the new party's state convention, and at the Republican National Convention he attempted to secure the vice presidential nomination for Abraham Lincoln. Recognized as a leading Illinois Republican, he ran unsuccessfully for Congress in 1859 and helped Lincoln win nomination and election as president the next year.
Civil War military duty further revealed Palmer's qualities of leadership and combativeness. Enlisting as a colonel shortly after Fort Sumter, he served courageously in several battles and reached the rank of major general. However, he criticized the arrogance of some West Point officers, feuded with General William T. Sherman, and antagonized both civil and army officials as Lincoln's military commander in Kentucky. By war's end his ardent views on African-American enfranchisement and Reconstruction placed him in the Radical wing of his party.