In this case, "it" refers to a person. Usually in English we refer to people as "he" or "she", but we use "it" when referring back to a person just mentioned in a sentence using a form of "to be". Like, "Who put this on my desk?" "It was Bob." Or, "Someone stole my coffee cup!" "Yes, it was Sally." You might think that it would be more consistent to say, "He was Bob" and "She was Sally". But we don't.
"It" can also refer back to some event just described. Like, "What caused XYZ Corporation to go bankrupt?" "It was bad management." Here "it" is referring to "the event that caused the company to go bankrupt".
Sometimes "it" is used as a kind of dummy placeholder. Like, "It is raining today." What is raining? Well, we're not really thinking of some THING that is raining. We're just saying that that's what's happening.