The Outsiders by S.E. Hinton is essentially a gang story, so we should not be surprised that gangs play such a significant role in the novel. Johnny is not the protagonist of the story; nevertheless, we know a lot about his life.
The short answer to your question is that the gang is important to Johnny because his fellow gang members are essentially the only real family he has.
Johnny is sixteen years old, and his home life has been a disaster. Ponyboy says Johnny looks like
a little dark puppy that has been kicked too many times and is lost in a crowd of strangers.
Ponyboy's assessment is pretty accurate. Johnny has been virtually ignored by his mother, and his father does nothing but abuse him. It is no wonder that Johnny is desperate to escape that environment--and the best part for him, quite frankly, is that no one notices his absence.
As if his treatment were not bad enough, Johnny also lives in fear of his life because he had a run-in with the Socs, a rival gang, in which he was horribly beaten. He sleeps outside a lot of the time, and he never really gets enough to eat. His life is pitiable in nearly every way. Life is so consistently bad that he considers suicide.
Once he becomes a member of Ponyboy's gang, Johnny is adopted as "everyone's kid brother." He is the youngest member of the gang, and the other members treat him well. Johnny is in a gang, but he is still a stand-up guy. He does not deliberately hurt anyone (with one glaring exception, late in the novel and with a reason). In fact, he stands up when he sees injustices.
While the gang serves as a kind of surrogate or substitute family for Johnny, the gang is still just a bunch of kids. They all do what they can, but of course it is not enough to rebuild a foundation for Johnny. His gang family is better than his real family, but they cannot completely fill the gaps left by his terrible home life.
For more interesting insights and analysis on this classic novel, visit the excellent eNotes sites linked below.