After receiving his commission, Van Buren was appointed to the 2nd Artillery Regiment. He took part in the Mexican–American War, including the Battle for Mexico City and the occupation of the city after the war. Van Buren was promoted to first lieutenant in 1849.