A look at the text
God tells Samuel, “I will punish the Amalekites for what they did to Israel when they waylaid them as they came up from Egypt,” (v. 2). You can read about this in Exodus 17:8-16 and Deuteronomy 25:17-19. Saul observes this part of the command quite carefully as he separates the Kenites from the Amalekites (v. 7). Whatever else then is true, it should be clear that this is no arbitrary action—it is the judgment of God upon a people for their crimes. Just as surely as the Kenites were exempted because they were not guilty, the Amalekites are singled out because they are.
But didn’t these misdeeds take place centuries of years before? Why is God punishing this group of people for something their ancestors did? Before we answer we should note that it is on record that God is remarkably slow to anger and forgiving of wickedness, rebellion, and sin (Exodus 34:6-7). Even after judgment has been declared, He has been known to suspend it in the face of penitence (Jonah 3:4,10).
The Amalekites weren’t punished immediately by God at the time of the exodus because He was giving them the opportunity to repent (Romans 2:4-5; 2 Peter 3:9)! Despite this gracious provision, they continued in their predatory ways (Judges 3:13,6:3-6,33,7:12,10:12). When they had finally exhausted the patience of God and are punished, is said to be for their crimes against Israel at the exodus. Why? Because the same spirit of wickedness and rebellion that was present in the exodus generation is alive in them! They have proven themselves to be their descendants/children by doing the same kind of thing (you must see Matthew 23:29-36, where Jesus says the same kind of thing to the Pharisees and the teachers of the law). Far from being a grudge bearing, unjust Deity, God is long suffering, merciful, and righteous (Psalm 89:14).
But what about the women, children and infants (v. 3)? Whatever the women’s culpability was (if any), it was surely less than the men’s, and the children and infants were innocent of any wrongdoing. Does God punish the innocent along with the wicked? That wouldn’t be the God who revealed Himself through Jesus, would it? We only reach this conclusion if we erroneously assume that all suffering is punishment.
In Ezekiel 9, the prophet has a vision where the people of Jerusalem “who grieve and lament over all the detestable things that are done,” are given a mark on their forehead (v. 4). This exempts them from the judgment to come where those without such a mark (the unrighteous), will be executed for their crimes (v. 5-10). Historically, this was fulfilled in the judgment God brought upon Jerusalem through the Babylonians beginning in 586 BC. Yet Ezekiel 21:3-4 makes it clear that both the righteous and wicked would perish.
How can that be? The explanation isn’t difficult. Both the righteous and wicked died when Jerusalem was invaded. But the vision of Ezekiel 9 is stressing the truth that only one group was being punished! Although external appearances would suggest that the judgment was indiscriminate as the righteous died right along with the wicked, the deeper truth is that this is not the case. Not all suffering should be interpreted as punishment. Is this a difference without a distinction since all ended up dead? Hardly. It is the difference between dying in the Lord and dying apart from Him. In other words, it is all the difference in the world.