I see. I understand your question now. Sorry, but I don't have a straightforward answer for you. "It" is the deferred subject of the sentence. Basically, the sentence can be rearranged so that the true subject is at the beginning of the sentence. "To go against her is dangerous." So technically, the "it" is replacing the subject "to go against her."