Robertson was a delegate to the state Secession Convention in January 1861, and subsequently raised a company of volunteers for the Confederate army and was elected as its captain when it became a formal part of the newly raised 5th Texas Infantry Regiment in the brigade of John Bell Hood. In November 1861, Robertson was elevated to lieutenant colonel, and then on June 1, 1862, to colonel and command of the regiment. He was in the Peninsula Campaign, serving with distinction during the Seven Days Battles and leading his regiment in a successful charge during the Battle of Gaines' Mill that split the Union lines.