Leviticus 18:24-25 can’t really be used to explain why God allowed warfare.
Leviticus was written while the Children of Israel were in the wilderness, after coming out of Egypt — i.e., they hadn’t got to the Promised Land, the land of Canaan, yet and so they hadn’t fought any wars there yet. And Leviticus 18:24-25 says the land of Canaan had already ‘vomited’ its inhabitants out, even before the Israelites got there. One way God did this is described in Exodus 23:28:
And I will send hornets before you, which shall drive out the Hivites, the Canaanites, and the Hittites from before you.
Of course, when the Israelites finally got the Promised Land they also fought the peoples who still remained, with the intention of driving them out (see, e.g., Numbers 33:53), so the Israelites continued this work that God had begun. With this in mind, Leviticus 18:24-25 says that God started to drive out the former inhabitants of the land of Canaan because they had ‘become unclean’ (i.e., sinful) and, by driving them out, God was punishing them for their ‘iniquity’. This idea can probably be used to partly explain why God later also used warfare: i.e., God commanded his people to continue his work and drive the other inhabitants out of the land of Canaan because those people had become sinful. Additionally, if the Israelites didn’t drive them out then they would be a terrible influence on the Israelites (compare, e.g, Numbers 33:55).