The Greek term behind the phrase “if necessary” captures the notion of divine necessity, of God ordaining these things. In fact, the existence of hostility and bruising was the promise God first voiced to Adam and Eve upon their expulsion from Paradise (Genesis 3:15). Jesus had also said that his people would invariably experience the same sort of hostility he experienced (John 15:18–19). Peter will come back to this in 1 Peter 4:1.
6 In this you rejoice, though now for a little while, if necessary, you have been grieved by various trials,