So then King David could not possibly have been right with God, as he was married to several women that had been married to other men. But the Bible describes David as a man after God's own heart. Not only did God not require David to leave Bathsheba, she was the mother of Solomon! So it appears that there is redemption even in those kinds of circumstances, and that God can fully restore and do great things with those who have fallen.
And what of those who divorced and remarried before being saved? What if children are involved? What are those people to do? Should those people divorce and leave the children fatherless/motherless?
Some mistakes or sins can't be "fixed" in this life - all we can do is ask to be forgiven. And thank God, He forgives ALL sins.
As I recall God killed David's son, condemned his kingdom to permanent warfare and promised armed conflict within in own house ( subsequently manifested in the Absolom uprising). So there were permanent consequences to David's actions.