How could God, who knows all things (1 John 3:20), never have thought of something? It makes no sense. Jeremiah 7:31 is where God says, “They have built the high places of Topheth, which is in the valley of the son of Hinnom, to burn their sons and their daughters in the fire, which I did not command, and it did not come into My mind.”
The answer is twofold. “it did not come into my mind” means that God did not entertain such a horrendous thought. It does not mean He did not know. A person can know something but not think about it. So, there is no contradiction. Furthermore, the Hebrew is literally, “heart” instead of “mind.” It is dealing with the intention of God.
Second, God used a figure of speech. It is not a literal statement of fact concerning God’s ignorance. God knew about the child sacrifices as they related to the Israelites (Lev. 18:21; Deut. 12:31). God was speaking to Jeremiah about the sins of the people of Israel in their idolatry. So when God says it never entered his mind, it’s not that he didn’t know about it, but that His people who were called by Him would ever do such a horrible thing. But, of course, He knew they would.
In fact, God uses another figure of speech in Jeremiah 7:3, “I thought, ‘After she has done all these things she will return to Me’; but she did not return, and her treacherous sister Judah saw it.’” Also, Jeremiah 36:3, “Perhaps the house of Judah will hear all the calamity which I plan to bring on them, in order that every man will turn from his evil way; then I will forgive their iniquity and their sin.””
Context of “it did not come into my mind”
The context was that God spoke to Jeremiah (Jer. 7:1-2). He then speaks about the sins of the people with an admonition (vv. 3-7), condemnation (vv. 8-11), judgment (vv. 12-20), talk about burnt offerings (vv. 21-22), the past call to obedience (v. 23), the past failure to repent (vv. 24-26), and a call to repentance (vv. 27-31).
Verses 21 to 22 say, “Thus says the LORD of hosts, the God of Israel, ‘Add your burnt offerings to your sacrifices and eat flesh. 22 ‘For I did not speak to your fathers, or command them in the day that I brought them out of the land of Egypt, concerning burnt offerings and sacrifices.”
So, “it did not come into my mind” means that God did not entertain in His mind the horrendous practice of child sacrifice, especially regarding a people he had called out of Egypt. He knew about it. He just did not dwell on it, the same way a person can know something but not think about it. Second, God was using a figure of speech, just as He did in Jer. 7:3 and 36:3.