Heiman volunteered for service in the Mexican–American War of 1846–48. He was commissioned as a First Lieutenant in the 1st Regiment of Tennessee Volunteers. He became the regimental Adjutant and was wounded in the Battle of Cerro Gordo. He was wounded again at the Battle of Monterrey. When the war ended he was breveted as Major.