Gobat was born on May 21, 1843 at Tramelan, Switzerland. He was the son of a Protestant pastor. He was the nephew of Samuel Gobat, a missionary who became bishop of Jerusalem. He was educated at the University of Basel, University of Heidelberg, University of Bern, and University of Paris. He received his doctorate in law, "summa cum laude", from the University of Heidelberg in 1867.