How Bathsheba's Extramarital Affair Took Place In The Bible
It's not an exaggeration to call David one of the towering heroes of the Old Testament — in addition to killing the giant Goliath, he managed to unite Israel into a single, powerful kingdom and bring the ark of the covenant home after its capture by the Philistines. He was also, as anyone who's read the Bible's 150 Psalms will tell you, quite the prolific poet. Along with Abraham and Moses, he easily ranks as one of the early founders of Judaism — and yet, Scripture makes no attempt to portray him as perfect. In 2 Samuel 11 and 12, we find an account of what history has dubbed David's "Great Sin" — his rape of Bathsheba and murder of her husband Uriah.
According to the text, this takes place "In the spring of the year, when kings go out to battle" — because apparently there was a "war season" back then. Regardless of what you think of that, though, it's pretty clear David is doing it wrong, sending his armies off to battle while sitting at home to twiddle his thumbs.
In any case, David apparently has some time to kill, because he's walking around on his roof and sees Bathsheba bathing in her courtyard, "and the woman was very beautiful," according to the Bible. (It's worth pointing out here that David is the creep; despite how countless people, including Leonard Cohen, have gotten it wrong, David is the one on the roof, not her.)
David sends for Bathsheba
David decides to deal with the existence of an attractive woman the only way that powerful men know-how, which is to force himself on her. According to 2 Samuel, he "sent messengers and took her, and she came to him, and he lay with her." There's considerable debate among modern commentators as to whether David's actions constitute rape (see, for instance, these pieces at Theology of Work Project and Got Questions). Still, regardless of the semantics of what constitutes adultery in the Biblical context vs. rape, it's also clear that thanks to the enormous power differential between the two, Bathsheba had plenty of reason to fear for her life if she resisted David's advances, which ... makes things sound pretty non-consensual, at the very least.
Unfortunately, the encounter leaves Bathsheba pregnant, which threatens to blow the lid off the whole thing. David's solution to this problem is to bring Bathsheba's husband Uriah back from the battlefield and try to trick him into going home and having sex with his wife; unfortunately (again), Uriah's answer is, "The ark and Israel and Judah dwell in booths, and my lord Joab and the servants of my lord are camping in the open field. Shall I then go to my house, to eat and to drink and to lie with my wife? As you live, and as your soul lives, I will not do this thing."
David murders Uriah
David's Plan B (or are we up to Plan C at this point?) is to murder his way out of his rape predicament, sending Uriah back to the battlefield and instructing his general to put Uriah in the frontlines, "and then draw back from him," leaving him a sitting duck. This does the trick, so to speak: David marries Bathsheba and gets ready to live happily ever after — until the prophet Nathan gets wind of what he's been up to and comes to lay down the law.
Nathan visits David and tells him a parable about a rich man who owns a large flock of sheep — but, when he has to feed his guests, steals a poor man's only lamb instead of slaughtering one of his own sheep. David gives him the exact response he was looking for: "As the Lord lives," David says, "the man who did this deserves to die!" Nathan responds, "You are the man [and not in a good way]!"
Long story short, David repents of his sin and God punishes him by killing his and Bathsheba's newborn child. The next child she bears to David, however, turns out to be a guy named Solomon — whom you might recognize as growing up to become an even greater king than his father.