Montgomery fought in the Mexican–American War from 1846 to 1848 as a captain of the 8th United States Infantry Regiment. He was engaged in the Battle of Palo Alto on May 8, 1846 and the Battle of Resaca de la Palma, May 9, 1846, where he was wounded. Montgomery was appointed brevet major for gallant and meritorious conduct at the Battles of Palo Alto and Resaca de la Palma. He then served on recruiting service in 1846‑47.