Martin was commissioned as a second lieutenant in the First Regiment of the United States Artillery. He served mainly on the northern coast, on the frontier of Maine, in the Aroostock War, and in the coastal survey. He served in the Mexican War and took part in the battles of Monterey, Vera Cruz, Cerro Gordo, Contreras and Churubusco, where he lost his right arm after it was shattered by grapeshot. After the wounding, Martin left the field with his sleeve clenched between his teeth and relinquished command of the battery to Stonewall Jackson. Due to the loss of his arm, Martin became known by the nickname "Old One Wing." Martin was brevetted as a major for his performance at Churubusco and Contreras.