Resigning his commission on June 14, 1861, Martin offered his services to North Carolina, and was commissioned as a captain in the cavalry. Martin was later appointed adjutant general of North Carolina. At his suggestion, blockade-running ships were first employed to bring supplies to the Confederacy from Europe. On September 28, 1861, he was appointed commander-in-chief of the state forces, with the rank of major general of militia. Martin was able to raise 12,000 more men than the state quota. After Martin had completed this work, he applied for duty in the field, and in May 1862, he was promoted to brigadier general in the provisional army. In August 1862, he was given command of the district of North Carolina, with headquarters at Kinston, North Carolina. In the fall of 1863, he was directed to organize a brigade from the troops at his disposal and take the field. With this brigade, he went into camp near Wilmington, North Carolina. 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. When the Overland Campaign opened, Martin was called to Petersburg. He was the first in the field under Major General William Henry Chase Whiting. 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. Afterwards his men carried him around on their shoulders, shouting, "Three cheers for Old One Wing." The brigade was then assigned to Robert Hoke's division, and reinforced Robert E. Lee at Turkey Hill during the Battle of Cold Harbor, where they repulsed the Union assaults on June 3, and afterward were engaged in a sharpshooting fight along the line. 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. Lee then sent Martin's brigade to Petersburg. 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. After he had left the Army of Northern Virginia, Lee stated that "General Martin is one to whom North Carolina owes a debt she can never repay." Martin surrendered the Army of Western North Carolina in Waynesville, North Carolina on May 6, 1865. This was the last organized Confederate force remaining in the state.
Post-war life
After the war ended, Martin was financially ruined. He studied law and practiced it in Asheville for the remainder of his life. Martin died on October 4, 1878 and is buried in Asheville's Riverside Cemetery.