He saw his first combat during the Mexican–American War, where he received a brevet promotion to major for his actions at the Battle of Cerro Gordo. Allen was transferred to the Quartermaster's Department, and was eventually promoted to the chief quartermaster at Benicia, California, for the Department of the Pacific with the permanent rank of major.