Setting aside, briefly, the issue of divine violence in the Old Testament, I want you to notice this brilliant literary touch in Exodus. The book begins with the command to commit genocide against the Israelite slave population in Egypt. Pharaoh commands that every Israelite male infant is to be drowned in the Nile river. Grisly stuff.
And yet listen to how Moses' (who was meant to be drowned) and Israel's story with Egypt concludes in Exodus 14 as they cross the Red (or Reed) Sea. "The waters came back and covered the chariots and the riders of all Pharaoh's force who were coming after the Israelites in the sea, not a single one of them remained...Israel saw Egypt dead on the shore of the sea."
Notice the great reversal in the matter of a few chapters. Pharaoh commands genocide through drowning. In doing so he sets about a chain reaction of events that whips back onto him and the drowning of his army.
Scripture tells us that the wages of sin is death. We see that worked out here. The sin of genocide-by-drowning has a wage in the book of Exodus—and that wage is by the drowning of the very army that attempted the evils of murder in the first place.