1878, geestring, "loincloth worn by an American Indian," originally the string that holds it up, etymology unknown. The spelling with G (1882) is perhaps from influence of violin string tuned to a G (in this sense G string is first recorded 1831), the lowest and heaviest of the violin strings. First used of women's attire 1936, with reference to strip-teasers.
I AM the spirit of the silver "G":
I am silvered sadness,
I am moonlit gladness,
I am that fine madness
Of reverence half, and half of ecstasy
[from "Spirit of the 'G' String," Alfred L. Donaldson, in "Songs of My Violin," 1901]