Hello, @Jaikar. You have some really great questions!
First, the rendering of the Scripture given here, “I have given your master’s wives into your arms” is not exactly an accurate rendering. The Hebrew word this version is translating as “arms” actually translates to “bosom.” Whenever someone was taken into someone else’s bosom in the Bible, it was usually referring to a care-taking or stewarding role as opposed to marriage. The New King James Version gives a bit more accurate of a rendering, reading, “I gave you your master’s house and your master’s wives into your keeping…” So the verse is not saying that God gave David his master’s wives to take them as his own wives. God gave them over into David’s care. If He had not, the wives would have been turned out with no where to go and no one to care for them.
I myself struggled with this issue for quite some time. If we ask this of the text here, then we must ask it of all similar situations in life. Why did God allow that innocent child to die at the hands of her abusive parents? Why does God allow innocent children to die of starvation?
There is indeed suffering in this world because it is broken. And it is understandable that we see physical death as something horrific and punishing. But it is important to see death from God’s perspective. For example, one of our good friends from our previous church died of cancer. People were saying, “It just wasn’t God’s plan to heal her.” I asked, “Do you believe she is with the Lord?” “Well, of course!” They exclaimed. I then asked, “Then how is it that we claim that God did not heal her?” We have to understand that while from our very limited view, death looks like the end because we no longer see the person here, God sees the life that is available beyond the “first” death. In a recent talk from the Saturday session, “The Task in a Time of Crisis,” Ravi makes the point that God is over all of time. Jesus is Lord of the past, present, and future, so Jesus is the reference point for everything that happens anywhere on the time line. Jesus is the single interpretive figure of all of history. This fact should change our perspective a bit, I would think. To us who see him no more, the child is dead, but to God who sees him still, he is alive and more well than he ever could have been on this earth with all its troubles because of Jesus and his work on the cross.
This is my take on it. Let me know if this helps or leads to more questions!