
Johnson thought that he could be a compromise candidate for the 1860 presidential nomination as the Democratic Party tore itself apart over the slavery question. During the 1860 Democratic National Convention in Charleston, South Carolina, he sent two of his sons and his chief political adviser to represent his interest. The convention deadlocked, but the sides were too far apart to consider Johnson as a compromise. The party split, with Northerners backing Illinois Senator Stephen Douglas while Southerners, including Johnson, supporting Vice President Breckinridge for president. When the Republican Party elected its first president, former Illinois representative Abraham Lincoln, talk of secession from the Union began to heat up.
Johnson took to the Senate floor after the election, giving a speech in which he said "I will not give up this government. No, I intend to stand by it, and I invite every man who is a patriot to rally around the altar of our common country and swear by our God, and all that is sacred and holy, that the Constitution shall be saved, and the Union preserved." As Southern senators announced they would resign if their states seceded, he reminded Mississippi Senator Jefferson Davis that if Southerners would only hold to their seats, the Democrats would control the Senate, and could defend the South's interests against any infringement by Lincoln.
Johnson returned home to campaign against the issue of secession. Governor Isham G. Harris had organized a referendum on whether to have a constitutional convention to authorize secession. Despite threats on Johnson's life, and actual assaults, he campaigned against both questions, sometimes speaking with a gun on the lectern before him. Johnson's eastern region of Tennessee was against secession, but the second referendum passed, and in June 1861, Tennessee joined the Confederacy. Believing he would be killed if he stayed, Johnson fled the state through the Cumberland Gap, where his party was fired upon.
As the only member from a seceded state to remain in the Senate and the most prominent Southern Unionist, he had Lincoln's ear in the early months of the war. With most of Tennessee in Confederate hands, Johnson spent congressional recesses in Kentucky and Ohio, trying in vain to convince any Union commander who would listen to conduct an operation into East Tennessee.
Johnson's first term in the Senate came to a conclusion in March 1862. Lincoln appointed him military governor of Tennessee. By that time much of the central and western portions of the state had been recaptured. Lincoln decided to appoint military governors over Union-controlled Southern areas. The Senate confirmed Johnson's nomination along with the rank of brigadier general. When the appointment was announced, the Confederates confiscated his land, took away his slaves, and made his home into a military hospital.
As military governor, Johnson sought to eliminate rebel influences in the state, demanding loyalty oaths from public officials, and shutting down newspapers run by Confederate sympathizers. Much of eastern Tennessee still remained in rebel hands, and the ebb and flow of war through 1862 sometimes brought Confederate control close to Nashville. The Confederates allowed Johnson's wife and family to pass through the lines to be with him.
Johnson undertook the defense of Nashville as best he could; the city was continually harassed with cavalry raids led by General Nathan Bedford Forrest. Relief from Union regulars did not come until William S. Rosecrans defeated the Confederates at Murfreesboro at the start of 1863. Much of eastern Tennessee was retaken later that year.
When Lincoln issued the Emancipation Proclamation in January 1863, freeing the slaves in rebel-controlled areas, he exempted Tennessee at Johnson's request. There was great debate over what should happen to the slaves after the war. Not all Unionists supported abolition. Johnson decided that slavery had to end, stating, "If the institution of slavery seeks to overthrow it [the Government], then the Government has a clear right to destroy it". He reluctantly gave his support to efforts to recruit former slaves for the Union Army. He believed that African-Americans should perform menial tasks. Nevertheless, he succeeded in enlisting 20,000 black troops for the Union.

In 1860, Lincoln's running mate had been Maine Senator Hannibal Hamlin. Vice President Hamlin had served competently, was in good health, and was willing to run. But when his re-election looked in doubt, Lincoln chose Johnson as his running mate in 1864, hoping to attract support from a broader base. Lincoln ran under the banner of the National Union Party, rather than the Republicans. At the party's convention in Baltimore in June, the Lincoln-Johnson ticket was easily nominated, and went on to win the election of 1864. Several weeks later, when Abraham Lincoln was assassinated at Ford's Theatre by John Wilkes Booth, Andrew Johnson was sworn in as the 17th President of the United States.