Gardiner was born in Southampton County, Virginia in the United States. In 1831, when he was still a child, his family relocated to Liberia under the sponsorship of the American Colonization Society. Gardiner received his law degree in Liberia and, in 1847, he served as a delegate to the National Convention, which drafted Liberia's declaration of independence and constitution. He became Liberia's first attorney general and later served in the National Legislature from 1855 to 1871.
In May 1871, he was elected vice-president and was elected once again, serving until 1876. During the incapacitation of President J. J. Roberts from 1875 until early 1876, Gardiner was also acting president.
Less than two years after leaving office as acting president, Gardiner won election to the presidency, taking office in 1878. In the same election, the True Whig Party won a massive victory and proceeded to dominate Liberian politics until the coup d'état in 1980, which brought in a Krahn-dominated military dictatorship. Gardiner himself was re-elected to two further two-year terms.
The decades after 1868, escalating economic difficulties weakened the state's dominance over the coastal indigenous population. Conditions worsened, the cost of imports was far greater than the income generated by exports of coffee, rice, palm oil, sugarcane, and timber. Liberia tried desperately to modernize its largely agricultural economy. As president, Gardiner called for increased trade with and investment from outside countries, improved public education, and closer relations with Liberia's native peoples. However, his policies were overshadowed by the ramifications of the European powers "scramble for Africa".
Rivalries between the Europeans colonizing West Africa and the interest of the United States helped preserve Liberian independence during this period, and until 1919, in spite of Liberia's ongoing disputes with England and France.
During Gardiner's administration difficulties with the British Empire and with Germany reached a crisis. Liberia was drawn into a border conflict with the British Empire over the Gallinas territory, lying between the Sewa River and the Mano River—territory which now forms the extreme eastern part of Sierra Leone. The British made a formal show of force at Monrovia in a mission led by Sir Arthur Havelock; meanwhile, the looting of a German vessel along the Kru Coast and personal indignities inflicted by the natives upon the shipwrecked Germans, led to the bombardment of Nana Kru by a German warship and the presentation at Monrovia of a claim for damages, payment of which was forced by the threat of the bombardment of the capital.
President Gardiner resigned on January 20, 1883, due to a serious illness. He was succeeded by the vice-president, Alfred F. Russell. Two months later, in March 1883, the British Government would annex the Gallinas territory west of the Mano River and formally incorporate it into Sierra Leone.