Sovereign states abide by international law for at least two reasons.
First, abiding by international law can, states hope, lead other states to do the same. If all states abide by international law, there is less conflict in the world. If this happens, states have increased their security by following international law.
Second, abiding by international law can give a state a good image in the eyes of other states. This can have tangible benefits for the state that maintains the good image. If a state has a good image in the eyes of other states, the other states are more likely to maintain good relations with it and to trust it. This, too, tends to increase the security of the state that follows international law.