In 1843 Franklin Gardner graduated from the United States Military Academy 17th in his class, the same year that future United States General Ulysses S. Grant graduated. After graduation Gardner first served in Pensacola, Florida, until the outbreak of the Mexican-American War. During the war, he served under Zachary Taylor and Winfield Scott, and was noted for bravery at the Battles of Monterrey, Churubusco, Molino Del Rey, and the Siege of Vera Cruz. He served in the United States Army until the outbreak of the Civil War, when he returned to Louisiana with his wife’s family and joined the Confederate army.
Gardner first commanded at the Battle of Shiloh, where he led a brigade of cavalry. As a result of his actions, he was promoted to brigadier general on April 11, 1862. Gardner then participated in the invasion of Kentucky with General Braxton Bragg, before being transferred and placed in command of Port Hudson. Once placed in command at Port Hudson, Gardner spent considerable time and effort improving fortifications in preparation for an expected Union attack. Once the Union attacks began on Vicksburg, Mississippi, many of the troops under Gardner were withdrawn, leaving him with only 7,000 men to protect the strategic position. By May 22, 1863, Gardner and his men were surrounded in Port Hudson by Union forces under the command of General Nathaniel P. Banks. The siege lasted until July 9, 1863, when Gardner and his men finally surrendered after hearing of the collapse of Vicksburg. Gardner was exchanged in August of 1864, and served for the rest of the war in Mississippi under General Richard Taylor.