David met Bathsheba, the mother of Solomon, one morning, as he was standing on the roof of his palace and saw a naked woman performing ablutions after her period. David learns her name is Bathsheba, and they have sex. She becomes pregnant. Seeking to hide his sin, David recalls her husband, Uriah the Hittite, from battle, David encourages him to go home and see his wife, but Uriah declines in case David might need him, and sleeps in the doorway to the palace that night.
David, in spite of inviting Uriah to feasts, continues to be unable to persuade him to go home. David then deliberately sends Uriah on a suicide mission. David loses some of his best warriors in this mission, so Joab tells the messenger reporting back to tell David that Uriah is dead.
David instructs Joab to continue the attack on the city. After Bathsheba has finished mourning Uriah, David marries her and she gives birth.