Earliest cite in OED is this one from Sylvia Plath.
1963 S. Plath in London Mag. Jan. 16 Come here, sweetie, out of the closet.
I’d be very surprised if there weren’t earlier though. I sometimes wondered if it had any connection with the phrase skeleton in one’s closet or cupboard but perhaps not. Come out itself in the homosexual sense is a natural development of the earlier meaning.
to come out
13. To show oneself publicly (in some character or fashion); to declare oneself (in some way); to make a public declaration of opinion. Also spec. to acknowledge publicly one’s homosexuality.
1637 S. Rutherford Lett. (1863) I. clxvii. 390 Eyes to discern the devil now coming out in his whites.
1837 Dickens Pickwick Papers xxxvi. 397 When he began to come out in this way.
1844 Fraser’s Mag. 30 584/2, I have hoards of gold laid by..and could come out as a Crœsus when I chose.
1850 Tait’s Edinb. Mag. July 425/2 Why you come out so strong in favour of one cause?
1876 W. Stubbs Early Plantagenets iv. 65 Now he [Becket] comes out as a candidate for martyrdom.
1968 Globe Mag. (Toronto) 13 Jan. 6/4 Several I spoke to referred to the difficulties they experienced in ‘coming out’—realizing they were homosexuals.