Barnes was the eldest son of John Barnes, a solicitor, and his wife Mary, née Anderson.
After considering a career as an academic, Barnes acceded to his family's wishes and embarked on a career in the law, moving to London in 1809 and entering the Inner Temple.