What if I told people about this girl's past?
Tell me more about what you did. Why did you reveal things to people?
She was stupid and really needed to be called out.
This girl had obviously trusted you with some secrets from her past, and you should have respected her privacy. Even if she had upset you in the moment, the consequences of revealing her past were much worse, and you should try to apologize and find a way to fix the damage.
Will it make me look bad if I apologize?
Apologizing when you've made a mistake will make you appear mature and responsible. It will be a great thing for you to admit to that mistake.