If you see war as a struggle to get access to scarce resources and if you notice that currently humankind is depleting most of the available resources then you might come to the conclusion that if in the future we will not need to go to war something terrible must have happened. Are you sure about the future you want?
Since you stipulated our species, to me, the answer is an external threat to the whole. Aliens, higher or lower dimensional creatures, cryptids, flame unicorns sharting lava, even angels or demons if we want to get real wild.
Even just the threat of an existential terror such as these and probably a lot I missed, (feel free to add to the list! Feed me your existential threats!) has the potential to bring the species together to fight on a larger scale.
However this doesn't eliminate war just moves the focus. So I'm not sure if I've answered your question or not but I had fun doing it!
I feel like the cultural/political responses to both global warming and COVID-19 have shaken my faith in this sort-of Watchmen scenario working out. No matter how universal the threat, seems like some groups will always find an angle to work that cuts against the "greater good."