Most commentators feel that God struck Moses with a life-threatening illness by which He was going to kill, to slay. It came to Moses, undoubtedly during prayer or meditation, that the problem was his resisting God in the circumcision of his son.
There is an interesting sidelight here. From the information provided, the son had not been circumcised because Moses conceded to Zipporah that the son would not be circumcised. What God was teaching Moses is that, as the head of the house, he was responsible to see that God's rules, orders, policies, and directions were followed.
Once he passed the test, Moses was convinced of something else: He knew that Zipporah could not go with him to Egypt. Therefore, he sent her back, and he went on alone. At least his life was spared because he followed through in doing what he should have done.
John W. Ritenbaugh
Conviction, Moses and Us
Why Did God Try to Kill Moses (Exodus 4:24-26)?
Hebrew scholars are still undecided whether God sought to kill Moses or his son. Verse 24 does not clearly give the answer, though the pronoun "him" seems to have its antecedent in "Moses" in verse 21.
Moses knew that all Israelites were to be circumcised on the eighth day of their lives (Genesis 17:9-14). However, his wife Zipporah was not an Israelite but a Midianite, who obviously did not follow the Abrahamic covenant of circumcision (though the Midianites were descendants of Abraham through his second wife, Keturah; see Genesis 25:1-2). Apparently, Moses failed to circumcise his son because of her objection to the practice.
Exodus 4 shows that Moses, returning to Egypt to lead God's people Israel to the Promised Land, did not have his own house in subjection (see I Timothy 3:4). God could not allow His direct representative to lead the entire nation of Israel when he had not himself faithfully brought his family under the covenant, of which circumcision was the sign. That God acted to "cut him off" illustrates just how seriously God takes our commitment (or lack thereof) to His covenant (Hebrews 10:26-31).
The Covenants, Grace, and Law (Part 6)
The Covenants, Grace and Law (Part 7)