Because I do not know what might lie behind your question, all I can do is respond in a general way. Your question has me think of how God worked in the lives of David and Bathsheba. God’s determination was that the child conceived and born from their adulterous relationship would die (2 Samuel 12:14-18). While God holds people personally responsible for their own sinfulness and sins (Ezekiel 18:4) and does not punish children for the sins of their parents (Ezekiel 18:20), one of the temporal consequences of David and Bathsheba’s sin was that the child born to them would die in infancy.
When I consider that action on God’s part, thoughts like these come to mind: “Our God is in heaven; he does whatever pleases him” (Psalm 115:3). “God is not unjust” (Hebrews 6:10). “For my thoughts are not your thoughts, neither are your ways my ways,” declares the LORD. “As the heavens are higher than the earth, so are my ways higher than your ways and my thoughts than your thoughts” (Isaiah 55:8-9). “Oh, the depth of the riches of the wisdom and knowledge of God! How unsearchable his judgments, and his paths beyond tracing out! “Who has known the mind of the Lord? Or who has been his counselor?” “Who has ever given to God, that God should repay them?” For from him and through him and for him are all things. To him be the glory forever! Amen.” (Romans 11:33-36).
One very important thing to keep in mind is that God, in the Bible, tells us why the son born to David and Bathsheba died in infancy. If we did not have that information in the Bible, we would not have known why the child died. That means that when the death of a person takes place today, we cannot pretend to speak for God when he has not spoken on the matter. So, while the Bible answers your question in the affirmative regarding God’s past actions, all we can do is maintain that possibility—in a general way—concerning God’s present and future actions.