Nothing prevents the baptized from becoming heretics and thus opposing the Church. Protecting the Church against harmful influence ("adversaries"), like the arch-heretic Luther, is the rationale for trying heretics and, if necessary, even delivering them to the State for punishment (e.g., the death penalty):
St. Thomas Aquinas's Summa Theologica II-II q. 11 a. 3 c.:
With regard to heretics two points must be observed: one, on their own side; the other, on the side of the Church. On their own side there is the sin, whereby they deserve not only to be separated from the Church by excommunication, but also to be severed from the world by death. For it is a much graver matter to corrupt the faith which quickens the soul, than to forge money, which supports temporal life. Wherefore if forgers of money and other evil-doers are forthwith condemned to death by the secular authority, much more reason is there for heretics, as soon as they are convicted of heresy, to be not only excommunicated but even put to death.
However, he advocates mercy; he continues:
On the part of the Church, however, there is mercy which looks to the conversion of the wanderer, wherefore she condemns not at once, but "after the first and second admonition," as the Apostle directs: after that, if he is yet stubborn, the Church no longer hoping for his conversion, looks to the salvation of others, by excommunicating him and separating him from the Church, and furthermore delivers him to the secular tribunal to be exterminated thereby from the world by death [as a last resort]. For Jerome commenting on Gal. 5:9, "A little leaven," says: "Cut off the decayed flesh, expel the mangy sheep from the fold, lest the whole house, the whole paste, the whole body, the whole flock, burn, perish, rot, die. Arius was but one spark in Alexandria, but as that spark was not at once put out, the whole earth was laid waste by its flame."
Thus, St. Thomas does not indiscriminately advocate the death penalty for heretics, but this illustrates heretics' danger to the Church; thus, heretics are adversaries.