He attended the United States Military Academy at West Point and graduated in 1840, fourteenth in the class, directly behind future Confederate general Richard S. Ewell.
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.
[1][2] After the Mexican War, Martin transferred to staff and was appointed assistant quartermaster and was stationed at Fortress Monroe, Philadelphia, Pennsylvania, and Governor's Island.
[1][2] When Major General George E. Pickett made his demonstration against New Bern in February 1864, Martin successfully attacked and drove the Union troops from Newport.
Major General Daniel Harvey Hill took command of the division on May 20, and Martin's brigade won distinction for their charge, driving the enemy from the works in their front.
Lee, believing Ulysses S. Grant would make another attack, informed Martin that he held the key to the Confederate position, and asked if his troops, comparatively new, could be relied upon.
Martin promptly responded that his men were as good as veterans, but that he thought he should be transferred to the south of the James River, as he believed Grant would attack Richmond from the rear.
During the siege, Martin's health gave way under the strain and exposure, and he was transferred to the command of the district of Western North Carolina, with headquarters at Asheville.