 In 1846 he became Colonel of the 1st Kentucky Cavalry during the Mexican–American War, where he fought at the Battle of Buena Vista as a part of Zachary Taylor's Army of Occupation.Returning from Mexico, Marshall engaged in agricultural pursuits in Henry County, Kentucky.He was elected from Kentucky's 7th District as a Whig to the Thirty-first and Thirty-second Congresses and served from March 4, 1849, until his resignation on August 4, 1852.