He was secretary of the navy in President Tyler's cabinet (1844-1845), and was attorney-general (1845-1846) and secretary of the navy (1846-1849), succeeding George Bancroft, under President Polk.
He was vicepresident of the United States from 1845 to 1849, but the appointment of Buchanan as secretary of state at once shut him off from all hope of party patronage or influence in the Polk administration, and he came to be looked upon as the leader of that body of conservative Democrats of the North, who, while they themselves chafed at the domination of southern leaders, were disposed to disparage all anti-slavery agitation.
In 1844 he was chosen as a presidential elector on the Polk and Dallas ticket; in February 1845 he married Miss Varina Howell (1826-1906) of Mississippi (a granddaughter of Governor Richard Howell of New Jersey), and in the same year became a Democratic representative in Congress.
He served in the Northern Campaign under his father-in-law, General Taylor, and was greatly distinguished for gallantry and soldierly conduct at Monterey and particularly at Buena Vista, where he was severely wounded early in the engagement, but continued in command of his regiment until victory crowned the American arms. While still in the field he was appointed (May 1847) by President Polk to be brigadier-general of volunteers; but this appointment Davis declined, on the ground, as he afterwards said, "that volunteers are militia and the Constitution reserves to the state the appointment of all militia officers."
The split broke up the rule of the "regency," Marcy accepting the " Hunker " support and a seat in Polk's cabinet, while Wright, Butler and Van Buren joined the " Barnburners," a step preliminary to Van Buren's acceptance of the " Free Soil " nomination for president in the campaign of 1848.