Walker was pro-slavery and tried to protect the freedom to own slaves as much as possible. He was a delegate to the Nashville Convention of 1850 where secession was brought up. In 1860 he was the leader of the delegation from Alabama for the national Democratic Convention. When the Democratic party did not support the protection of slavery in new territories, all the Alabama delegates walked out.
The southern states seceded in 1861 and formed the Confederate States of America. The Confederate President Jefferson Davis wanted a cabinet consisting of people from each state. Walker ended up being Davis's third choice for Secretary of War after the first two choices declined. He had no war experience, so he struggled with this position and ended up resigning after a disagreement with Davis. He was then made a brigadier general and commanded troops at Mobile and Montgomery in Alabama.