He was Colonel of the 2nd U.S. Dragoons at the outbreak of the Mexican-American War. He led a brigade in the Army of Occupation at the battles of Palo Alto and Resaca de la Palma. He was promoted to brigadier general and commanded a division at the Battle of Monterrey. He joined Winfield Scott's expedition, commanding its 2nd Division of Regulars and led the division in all the battles from Veracruz through Mexico City. He was wounded during the assault on Chapultepec. After the fall of Mexico City, he was appointed military governor of Veracruz. Brigadier General Twiggs was awarded a ceremonial sword by the Congress on March 2, 1847. (The sword was recovered when New Orleans was captured in 1862 and returned to the Twiggs family in 1889.)
After the Mexican-American War, Twiggs was appointed brevet major general and commanded the Department of Texas. He was in this command when the Civil War broke out. Twiggs's command included about 20% of the U.S. Army guarding the border of the U.S. and Mexico. As the states began to secede, Twiggs met with a trio of Confederate commissioners, including Philip N. Luckett and Samuel A. Maverick, and surrendered his entire command to them. At the time of his surrender, Twiggs was in San Antonio with approximately 200 Union soldiers, the remainder of his troops scattered along the border between the United States and Mexico. 2,000 Secessionist militia entered the city, intent on capturing the Union arsenal there. Outnumbered five to one, Twiggs surrendered on February 19, 1861.
Twiggs subsequently was dismissed from the U.S. Army for treason and accepted a commission as a major general from the Confederate States. He was appointed to command the Confederate Department of Louisiana, but his advanced age kept him from pursuing an active command and he retired on October 11, 1861. He died of pneumonia in Augusta, Georgia, and is buried at "Good Hope".