Let's set this one up before exposing it, just to give it context. David had killed a man and taken his wife for his own.
Thus says the Lord: 'I will bring evil upon you (David) out of your own house. I will take your wives while you live to see it, and will give them to your neighbor. He shall lie with your wives in broad daylight. You have done this deed in secret, but I will bring it about in the presence of all Israel, and with the sun looking down.'
Then David said to Nathan,
"I have sinned against the Lord." Nathan answered David: "The Lord on his part has forgiven your sin: you shall not die. But since you have utterly spurned the Lord by this deed, the child born to you must surely die."
-2 Samuel 12:11-14 NAB
So the punishment for David killing a man and taking his wife? To have his innocent wives raped, and to kill his innocent child.
How is this a moral story, and how is any book that contains it supposed to be informative of our (or our children's) morality?
It was clearly a book written by iron age sheep herders based on their own skewed "morality".
It's time to recognize this book for what it is.
What is it?
Read up, and YOU decide.