Gordon was born on 12 January 1832 in
Aberdeen and was a twin son of Captain William Gordon (1788–1834) of the 2nd Queen's Royal Regiment. His father had served in the
Peninsular War and was married at
Santarém, in 1818, to Marianna Carlotta Loi Gonçalves de Mello, daughter of Luiz Gonçalves de Mello, a Spanish government official in the province of
Estremadura. His father William Gordon was one of the sons of Adam Gordon (1750–1831) of Griamachary in the parish of Kildonan, Dingwall, whose sons and grandsons included thirteen commissioned officers, a
Surgeon-General, Huntly George Gordon; and a Lord Advocate and MP,
Edward Gordon, Baron Gordon of Drumearn. He and his twin brother, Sir
Thomas Edward Gordon, were the youngest children in a family of four sons and a daughter. John was educated at Dalmeny and at the
Scottish Naval and Military Academy, Edinburgh. Thomas Edward and John joined the British Army on the same day; both became
generals and were knighted. ==Army career==