II Samuel - Chapter 11
Bath-Sheba in the Bath
We now come to one of the most difficult stories in the Book: David and Bath-Sheba. (In Ashkenazi Hebrew, this author's usual default, that would be Bas-Sheva, but I think we'll go with the more easily recognizable Sephardi spelling, Batsheva.)
It was summer and David took an evening stroll on the roof of his palace. From the rooftop, he saw a woman bathing. (Many people misread verse 2 to say that she was bathing on her roof; that's not what it says. She was bathing - or using the mikva - inside; he could see in her window from HIS roof.) David sent messengers to inquire after her; she was Batsheva, the wife of Uriah the Hittite. (According to the Radak, he was called "the Hittite" either because he was an actual Hittite convert to Judaism, or because he used to live in a Hittite neighborhood.) David sent for her and slept with her. Later, she sent David a message that she was pregnant.This was especially awkward for David, since Uriah was away with the army and clearly it could not be his.
David sent a message to Yoav, commander of his army, that Uriah should be given leave and sent to Jerusalem. Uriah reported to David who asked how things were at the front. After perfunctory conversation, David instructed Uriah to go home to his wife. Uriah, however, did not listen. Instead, he slept in the entrance to the palace. When David found out, he called for Uriah and asked, "What's the matter with you?" (Very loosely paraphrased.) Uriah replied, "What kind of person would I be if I indulged in such comforts while my master Yoav and my fellow soldiers are sleeping in the field?"
So, David wined and dined Uriah, hoping that getting tipsy would loosen him up and get him to go home to his wife. It didn't work. So David wrote Yoav a letter, instructing him to put Uriah in the front lines, where the danger of being killed was greatest. (He wasn't instructed to kill him, just to assign him hazardous duty.) David sent the letter back with Uriah, who was apparently trustworthy enough that David wasn't worried he would read it!
Yoav put Uriah in the front lines and, sure enough, he got killed. Yoav sent word to David that the battle had gone poorly and that Uriah was among the dead. David understood the meaning implicit in Yoav's report and replied with general words of support and encouragement. Batsheva heard that Uriah had died and mourned him, After her mourning, David married her and she had a son. And, the Navi tells us, G-d was none too happy with what David had done.
The complication here is the question of what exactly did David do? Not only is adultery prohibited, one is not permitted to marry a woman with whom he had an adulterous affair. Even if David had done so extra-legally, G-d would never establish David's kingdom (and Moshiach - the Messiah) through an impermissible marriage! So what really happened?
Going to war, if a soldier never returned, his wife would remain an agunah - a woman who can never remarry because it is unknown whether her husband is alive or dead. Accordingly, soldiers would give their wives a get - a bill of divorce - that in the event they did not return was effective retroactive from the date of their departure to war. What David did was to ensure that Uriah's retroactive divorce kicked in, so that his affair was retroactively not extramarital. (It's complicated but technically effective. However, that doesn't make it right.)
As far as getting Uriah killed, David had legal grounds to do this. Uriah refused David's order to go home. His statement about the impropriety of sleeping in comfort while the army was in the fields was a tacit criticism of David, who slept in his palace. Referring to Yoav as "my master" (rather than "your servant") when speaking to David was a grievous breach of protocol, showing honor to the general over the king. A king would be justified in avenging his honor against these little rebellions, so David wasn't technically wrong, but these were small slights that he would normally overlook, were he not trying to cover up his own actions.
So David was wrong - make no mistake. But he wasn't as guilty of certain acts as a surface reading would make it appear. When great people make such spectacularly bad calls, the Torah and Nach express their misdeeds in the harshest terms. (See Talmud Shabbos pages 55b through 56b for many such examples.)