The deaths of which we read in this passage seem to be out of place in the New Testament. We expect these kinds of sudden judgments from the old covenant (see Numbers 16:1–50; Numbers 26:10) where curses were connected with disobedience and blessings with obedience (see Deuteronomy 28:1–68; Leviticus 26:1–46). Why do we find the same happening in the New Testament?
There are many answers to this question. For one it confirms to us that the Lord, who revealed himself to Moses and Israel, is the same Lord who is at work by his Spirit. God, who revealed himself in the Old Testament, is the same God who reveals himself in the New Testament. Added to this, the judgment serves to confirm and foreshadow the final coming judgment. If the healing of the lame man (Acts 3:1–10) serves to affirm that there will be a general resurrection where all ills are done away with, then the judgment of Ananias and Sapphira affirms that there will be a final judgment where sin is punished.
5 When Ananias heard these words, he fell down and breathed his last. And great fear came upon all who heard of it.