Zachary Taylor was chosen by the Whigs in 1848 because of his war record. The Miller Center of Public Affairs writes:
Since Andrew Jackson's election to the presidency in 1828, military leaders with a rough-hewn public persona -- whether genuine or not -- had been popular with voters. Helped largely by the behind-the-scenes negotiations of Thurlow Weed, Taylor led on the first ballot and clinched the nomination on the fourth.
Taylor was a Louisiana slave owner and so Millard Fillmore was selected to contrast him:
As a consolation prize to slavery opponents, the party searched for a vice presidential nominee who was more aligned with their views. Daniel Webster was offered the spot but refused, growling that Taylor was nothing but "an illiterate frontier colonel." A New York ally of Millard Fillmore's brought up his name, and the Whigs selected him as their candidate. As with so many other tickets, it was hoped that Fillmore's contrast in beliefs, style, and geographic origin with the presidential nominee would broaden the ticket's appeal.
While both parties tried to avoid the topic of slavery, it was on everyone's mind. The election was very close and both sides tried to use slavery to discredit their opponents.
Taylor and Fillmore's odd match - chosen for political reasons - would continue after the election:
The new vice president and President were an odd match. The tall, gentlemanly, well-dressed Millard Fillmore looked every bit the statesman. Zachary Taylor stood on unusually short legs -- during the Mexican War, he needed help climbing onto his horse, which he rode sidesaddle into battle; Old Rough and Ready was craggy, unkempt, and unlearned. The two had not met until after the election, and they did not hit it off when they did. Once in Washington, Taylor wasted no time shutting Millard Fillmore out of his administration. Other Whig leaders like Thurlow Weed and William H. Seward found favor with the new President and convinced him to deny Fillmore most patronage appointments in New York. The vice president's key ally, Henry Clay, was not offered a cabinet post. As vice president and thus president of the Senate, Fillmore held the tie-breaking vote in Senate sessions. In fulfilling these responsibilities, he was respected for his wisdom, humor, and ability to accommodate diverse views there. But he had virtually no role in Taylor's presidency.
The Compromise of 1850 became a major political issue of the term. Taylor took little interest, but threatened a veto of it. In July of 1850, Taylor suddenly died and Fillmore becomes President:
The presidency had suddenly fallen upon a forgotten man. Millard Fillmore, who had been all but banished from the Taylor administration and held opinions very different from the late chief executive, was suddenly the President of the United States. He immediately replaced Taylor's cabinet with proponents of the compromise and threw the full weight of his new administration behind its passage.
The country had elected a Louisiana war hero, but within 16 months, they had a New York politic an instead.