
Shelley was born in Sullivan County, Tennessee, on December 28, 1833, to William Park Shelley, a contractor and builder originally from North Carolina, and Margaret Finley Etter Shelley; he had perhaps nine siblings. At least one brother, James Shelley, fought for the Confederate States Army, in the Tenth Alabama Infantry Regiment. James was present at many important battles and would take charge of the regiment during the July 1863 Battle of Gettysburg after Col. William Henry Forney was badly wounded. James Shelley was killed during the Siege of Petersburg, Virginia, in June 1864. In 1836, the family moved to Alabama; sources disagree on whether they settled in Talladega, Talladega County, or Selma. Because of his family's lower economic status, Shelley could not afford a formal education, which led him to study architecture and construction methods under his father, continuing the family craft.
In February 1861, after Alabama seceded from the Union, Shelley volunteered at at Fort Morgan, Baldwin County, with the Talladega Artillery. During his stay at Fort Morgan, Shelley rose to the rank of lieutenant and was then elected captain of a small company that was placed in the Fifth Alabama Regiment. The unit was commanded by Gen. Robert Emmett Rodes. The troops were then sent to Virginia and were present at the First Battle of Manassas in Northern Virginia, though the infantry was not involved in active combat in this first major battle of the war. Shelley and his fellow soldiers traveled across Virginia, engaging in fighting during the 1862 Peninsula Campaign between the James and York Rivers.
In January 1862, Shelley was promoted to colonel and later organized the Thirtieth Alabama Infantry Regiment in Talladega in April 1862, recruiting men from surrounding counties. (Future representative Taul Bradford was also a member of the Thirtieth.) These soldiers reported for duty in Chattanooga, Tennessee, and later traveled westward into Mississippi and fought in several battles, including the Battle of Champion Hill, just to the east of Vicksburg. In it, Shelley's clothing was reportedly pierced seven times by bullets for which he was praised by Gen. Robert E. Lee. They then traveled west to reach the Mississippi River Valley in time for the 1863 Siege of Vicksburg, when Shelley and other members of the regiment were captured and then paroled in early July. Afterwards, the regiment recruited more men in Demopolis, Marengo County, and was placed in a brigade then under the command of Brig. Gen. Edmund Pettus. It entered the Chattanooga Campaign and fought in the November 1863 Battles of Lookout Mountain and Missionary Ridge. Shelley was temporarily given the rank of brigadier general to lead select troops into Tennessee, fighting in the November and December 1864 Battles of Franklin and Nashville, respectively. These proved to be disasters for the Confederacy and ended major fighting in Tennessee. During the Nashville battle, Shelley's brigade endured massive casualties, with nearly a thousand wounded. Early in 1865, Shelley's forces were moved back to North Carolina, and before Lee surrendered his army at Appomattox Court House, Virginia, on April 9, 1865, Shelley was home in Alabama.
After the war, Shelley returned to his architecture business and that June married Kathleen McConnell, a daughter of Congressman Felix Grundy McConnell. The couple appears to have had five children, two of whom died in infancy. In 1874, he entered local politics and served as the sheriff of Dallas County for two years. In 1876, Shelly began his campaign for the U.S. Congress.

Shelley moved to Birmingham, Jefferson County, and on January 20, 1907, died there at the age of 73. He was buried in Oak Hill Cemetery in Talladega.