Whistler served in the Mexican–American War, from 1846 to 1848, being engaged in the Siege of Veracruz, March 9 to 29, 1847, the Battle of Cerro Gordo, April 17‑18, 1847, the Battle of Contreras, August 19–20, 1847, the Battle of Churubusco, August 20, 1847. He was appointed brevet first lieutenant on August 20, 1847 for "Gallant and Meritorious Conduct" in the Battles of Contreras and Churubusco, Mexico.