Congress passed a bill authorizing the creation of ten regiments, and Pierce was appointed commander and colonel of the 9th Infantry Regiment in February 1847, with Truman B. Ransom as lieutenant colonel and second-in-command.[60]

Pierce's brief term as a general in the Mexican–American War boosted his public image.[61]
On March 3, 1847, Pierce was promoted to brigadier general, and took command of a brigade of reinforcements for General Scott's army, with Ransom succeeding to command of the regiment. Needing time to assemble his brigade, Pierce reached the already-seized port of Vera Cruz in late June, where he prepared a march of 2,500 men accompanying supplies for Scott. The three-week journey inland was perilous, and the men fought off several attacks before joining with Scott's army in early August, in time for the Battle of Contreras.[62] The battle was disastrous for Pierce: his horse was suddenly startled during a charge, knocking him groin-first against his saddle. The horse then tripped into a crevice and fell, pinning Pierce underneath and debilitating his knee.