This is a very good question, I wish it got more attention. My answer will only be partial for I had difficulty finding early details on gyromagnetic effect and ratio. The concept comes up every time we have a rotating system of charged particles, because it has angular momentum and creates a magnetic dipole field, and it played an important historical role already in classical physics, but ended up paving the way for the quantum one.
Larmor's precession formula and theorem first appeared in 1894-97 papers summarized in his comprehensive book Aether and Matter (1900), in a way the final summa of classical electrodynamics. Larmor was first to conjecture that electrons orbit a center, based on his precession formula he could then explain splitting and polarisation of spectral lines in a magnetic field. Ironically, according to Warwick, "Larmor is widely remembered by scientists for just two formulae and one theorem which, although correctly attributed to him, have been seen by historians of science as tangential to his main research interests".
At least implicitly, the ratio came up earlier in Maxwell's work on gyromagnetic effect. He noted that "electricity circulates with something like momentum or inertia" (even earlier Ampere conjectured that magnetism is caused by "molecular currents" in matter), and concluded that magnetization should cause slight rotation of the magnetized material. Maxwell's attempts to measure it were unsuccessful, but the mantle was picked up by none other than Einstein himself, who wanted to confirm Ampere's hypothesis. Together with de Haas he conducted a series of experiments in 1915-16 with theoretical predictions featuring the gyromagnetic ratio prominently. They denote it $\lambda$ and show that the theory predicts $\lambda=2e/m$, where $m,e$ are the mass and the charge of the electron. Of course, the formula would have been pointless earlier because the mass/charge ratio wasn't known. Their experiments confirmed the prediction, but... only due to a measurement error.
The truth is that the gyromagnetic effect in their experiments was due not to molecular currents, but to electron spin, and because it is $1/2$ the correct value is about half of their classical prediction. Curiously, Barnett who conducted similar experiments at the same time originally got values that differed from Einstein-de Haas ones by a factor of $2-2.3$, but after their publication "corrected" himself down to $1.1-1.4$, see Jeng's Selected History of Expectation Bias in Physics. However, the discrepancy soon came to light, and went under the name "gyromagnetic anomaly".
On how the anomalous gyromagnetic ratio led to the discovery of electron spin see Frenkel's paper On the History of Einstein-de Haas Effect, and Galison's book How Experiments End.