Save "David and Batsheva
"
David and Batsheva

(ב) וַיְהִ֣י ׀ לְעֵ֣ת הָעֶ֗רֶב וַיָּ֨קׇם דָּוִ֜ד מֵעַ֤ל מִשְׁכָּבוֹ֙ וַיִּתְהַלֵּךְ֙ עַל־גַּ֣ג בֵּית־הַמֶּ֔לֶךְ וַיַּ֥רְא אִשָּׁ֛ה רֹחֶ֖צֶת מֵעַ֣ל הַגָּ֑ג וְהָ֣אִשָּׁ֔ה טוֹבַ֥ת מַרְאֶ֖ה מְאֹֽד׃ (ג) וַיִּשְׁלַ֣ח דָּוִ֔ד וַיִּדְרֹ֖שׁ לָאִשָּׁ֑ה וַיֹּ֗אמֶר הֲלוֹא־זֹאת֙ בַּת־שֶׁ֣בַע בַּת־אֱלִיעָ֔ם אֵ֖שֶׁת אוּרִיָּ֥ה הַֽחִתִּֽי׃ (ד) וַיִּשְׁלַח֩ דָּוִ֨ד מַלְאָכִ֜ים וַיִּקָּחֶ֗הָ וַתָּב֤וֹא אֵלָיו֙ וַיִּשְׁכַּ֣ב עִמָּ֔הּ וְהִ֥יא מִתְקַדֶּ֖שֶׁת מִטֻּמְאָתָ֑הּ וַתָּ֖שׇׁב אֶל־בֵּיתָֽהּ׃ (ה) וַתַּ֖הַר הָאִשָּׁ֑ה וַתִּשְׁלַח֙ וַתַּגֵּ֣ד לְדָוִ֔ד וַתֹּ֖אמֶר הָרָ֥ה אָנֹֽכִי׃ (ו) וַיִּשְׁלַ֤ח דָּוִד֙ אֶל־יוֹאָ֔ב שְׁלַ֣ח אֵלַ֔י אֶת־אוּרִיָּ֖ה הַחִתִּ֑י וַיִּשְׁלַ֥ח יוֹאָ֛ב אֶת־אוּרִיָּ֖ה אֶל־דָּוִֽד׃ (ז) וַיָּבֹ֥א אוּרִיָּ֖ה אֵלָ֑יו וַיִּשְׁאַ֣ל דָּוִ֗ד לִשְׁל֤וֹם יוֹאָב֙ וְלִשְׁל֣וֹם הָעָ֔ם וְלִשְׁל֖וֹם הַמִּלְחָמָֽה׃ (ח) וַיֹּ֤אמֶר דָּוִד֙ לְא֣וּרִיָּ֔ה רֵ֥ד לְבֵיתְךָ֖ וּרְחַ֣ץ רַגְלֶ֑יךָ וַיֵּצֵ֤א אֽוּרִיָּה֙ מִבֵּ֣ית הַמֶּ֔לֶךְ וַתֵּצֵ֥א אַחֲרָ֖יו מַשְׂאַ֥ת הַמֶּֽלֶךְ׃ (ט) וַיִּשְׁכַּ֣ב אוּרִיָּ֗ה פֶּ֚תַח בֵּ֣ית הַמֶּ֔לֶךְ אֵ֖ת כׇּל־עַבְדֵ֣י אֲדֹנָ֑יו וְלֹ֥א יָרַ֖ד אֶל־בֵּיתֽוֹ׃

(יד) וַיְהִ֣י בַבֹּ֔קֶר וַיִּכְתֹּ֥ב דָּוִ֛ד סֵ֖פֶר אֶל־יוֹאָ֑ב וַיִּשְׁלַ֖ח בְּיַ֥ד אוּרִיָּֽה׃ (טו) וַיִּכְתֹּ֥ב בַּסֵּ֖פֶר לֵאמֹ֑ר הָב֣וּ אֶת־אוּרִיָּ֗ה אֶל־מוּל֙ פְּנֵ֤י הַמִּלְחָמָה֙ הַחֲזָקָ֔ה וְשַׁבְתֶּ֥ם מֵאַחֲרָ֖יו וְנִכָּ֥ה וָמֵֽת׃ {ס} (טז) וַיְהִ֕י בִּשְׁמ֥וֹר יוֹאָ֖ב אֶל־הָעִ֑יר וַיִּתֵּן֙ אֶת־א֣וּרִיָּ֔ה אֶל־הַמָּקוֹם֙ אֲשֶׁ֣ר יָדַ֔ע כִּ֥י אַנְשֵׁי־חַ֖יִל שָֽׁם׃ (יז) וַיֵּ֨צְא֜וּ אַנְשֵׁ֤י הָעִיר֙ וַיִּלָּֽחֲמ֣וּ אֶת־יוֹאָ֔ב וַיִּפֹּ֥ל מִן־הָעָ֖ם מֵעַבְדֵ֣י דָוִ֑ד וַיָּ֕מׇת גַּ֖ם אוּרִיָּ֥ה הַחִתִּֽי׃

(כז) וַיַּעֲבֹ֣ר הָאֵ֗בֶל וַיִּשְׁלַ֨ח דָּוִ֜ד וַיַּאַסְפָ֤הּ אֶל־בֵּיתוֹ֙ וַתְּהִי־ל֣וֹ לְאִשָּׁ֔ה וַתֵּ֥לֶד ל֖וֹ בֵּ֑ן וַיֵּ֧רַע הַדָּבָ֛ר אֲשֶׁר־עָשָׂ֥ה דָוִ֖ד בְּעֵינֵ֥י יְהֹוָֽה׃ {פ}


(יג) וַיֹּ֤אמֶר דָּוִד֙ אֶל־נָתָ֔ן חָטָ֖אתִי לַיהֹוָ֑ה {ס} וַיֹּ֨אמֶר נָתָ֜ן אֶל־דָּוִ֗ד גַּם־יְהֹוָ֛ה הֶעֱבִ֥יר חַטָּאתְךָ֖ לֹ֥א תָמֽוּת׃ (יד) אֶ֗פֶס כִּֽי־נִאֵ֤ץ נִאַ֙צְתָּ֙ אֶת־אֹיְבֵ֣י יְהֹוָ֔ה בַּדָּבָ֖ר הַזֶּ֑ה גַּ֗ם הַבֵּ֛ן הַיִּלּ֥וֹד לְךָ֖ מ֥וֹת יָמֽוּת׃

(כד) וַיְנַחֵ֣ם דָּוִ֗ד אֵ֚ת בַּת־שֶׁ֣בַע אִשְׁתּ֔וֹ וַיָּבֹ֥א אֵלֶ֖יהָ וַיִּשְׁכַּ֣ב עִמָּ֑הּ וַתֵּ֣לֶד בֵּ֗ן (ויקרא) [וַתִּקְרָ֤א] אֶת־שְׁמוֹ֙ שְׁלֹמֹ֔ה וַיהֹוָ֖ה אֲהֵבֽוֹ׃

(2) Late one afternoon, David rose from his couch and strolled on the roof of the royal palace; and from the roof he saw a woman bathing. The woman was very beautiful, (3) and the king sent someone to make inquiries about the woman. He reported, “She is Bathsheba daughter of Eliam [and] wife of Uriah the Hittite.” (4) David sent messengers to fetch her; she came to him and he lay with her—she had just purified herself after her period—and she went back home. (5) The woman conceived, and she sent word to David, “I am pregnant.” (6) Thereupon David sent a message to Joab, “Send Uriah the Hittite to me”; and Joab sent Uriah to David. (7) When Uriah came to him, David asked him how Joab and the troops were faring and how the war was going. (8) Then David said to Uriah, “Go down to your house and bathe your feet.” When Uriah left the royal palace, a present from the king followed him. (9) But Uriah slept at the entrance of the royal palace, along with the other officers of his lord, and did not go down to his house.

(14) In the morning, David wrote a letter to Joab, which he sent with Uriah. (15) He wrote in the letter as follows: “Place Uriah in the front line where the fighting is fiercest; then fall back so that he may be killed.” (16) So when Joab was besieging the city, he stationed Uriah at the point where he knew that there were able warriors. (17) The men of the city sallied out and attacked Joab, and some of David’s officers among the troops fell; Uriah the Hittite was among those who died.

(27) After the period of mourning was over, David sent and had her brought into his palace; she became his wife and she bore him a son.
But the LORD was displeased with what David had done,

(13) David said to Nathan, “I stand guilty before the LORD!” And Nathan replied to David, “The LORD has remitted your sin; you shall not die. (14) However, since you have spurned the enemies of the LORD by this deed, even the child about to be born to you shall die.”

(24) David consoled his wife Bathsheba; he went to her and lay with her. She bore a son and she named him Solomon. The LORD favored him, (25) and He sent a message through the prophet Nathan; and he was named JedidiahcI.e., “Beloved of the Lord.” at the instance of the LORD.

אָמַר רַבִּי שְׁמוּאֵל בַּר נַחְמָנִי אָמַר רַבִּי יוֹנָתָן: כׇּל הָאוֹמֵר דָּוִד חָטָא אֵינוֹ אֶלָּא טוֹעֶה, שֶׁנֶּאֱמַר: ״וַיְהִי דָּוִד לְכׇל דְּרָכָיו מַשְׂכִּיל וַה׳ עִמּוֹ וְגוֹ׳״.

Rabbi Shmuel bar Naḥmani said that Rabbi Yonatan said: Anyone who says that David sinned is nothing other than mistaken, as it is stated: “And David succeeded in all his ways; and the Lord was with him” (I Samuel 18:14).

So why does David himself say 'I have sinned' and then proceed to get punished? He clearly did something

דוד חטא - בבת שבע קודם שקבלה גט:

"[anyone who says] David Sinned [is nothing but mistaken]" - With Batsheva before she received a Get (divorce document)

אֶלָּא מָה אֲנִי מְקַיֵּים ״מַדּוּעַ בָּזִיתָ אֶת דְּבַר ה׳ לַעֲשׂוֹת הָרַע״ — שֶׁבִּיקֵּשׁ לַעֲשׂוֹת וְלֹא עָשָׂה.

David sought to do evil and have relations with Bathsheba while she was still married to Uriah but did not do so.

Let's clarify: The passukim imply David slept with a married woman, we are now being told he didn't. What is going on?

כְּשֵׁם שֶׁאֲסוּרָה לַבַּעַל — כָּךְ אֲסוּרָה לַבּוֹעֵל :(Proof 1(Halachic

כְּשֵׁם שֶׁאֲסוּרָה לַבַּעַל — כָּךְ אֲסוּרָה לַבּוֹעֵל, שֶׁנֶּאֱמַר: ״נִטְמָאָה״ ״וְנִטְמָאָה״, דִּבְרֵי רַבִּי עֲקִיבָא.

Regarding an adulterous woman:

Just as she is forbidden to her husband, so too is she forbidden to her lover

Now if you want to know why the Sages didn't render Batsheva forbidden to her husband due to adultery, perhaps this is a good answer:

כׇּל הַיּוֹצֵא לְמִלְחֶמֶת בֵּית דָּוִד, כּוֹתֵב גֵּט כְּרִיתוּת לְאִשְׁתּוֹ :(Proof 2(Halachic

מפני מה לא אסרוה - על דוד שהרי עדים הרבה ידעו:

Why wasn't she forbidden? - To David as there were many witnesses

And witnesses render a lover and a husband forbidden to the woman

דְּאָמַר רַבִּי שְׁמוּאֵל בַּר נַחְמָנִי אָמַר רַבִּי יוֹנָתָן: כׇּל הַיּוֹצֵא לְמִלְחֶמֶת בֵּית דָּוִד, כּוֹתֵב גֵּט כְּרִיתוּת לְאִשְׁתּוֹ.

As Rabbi Shmuel bar Naḥmani said that Rabbi Yonatan said: Anyone who goes to a war waged by the royal house of David writes a conditional bill of divorce to his wife. That was done to prevent a situation in which the soldier’s wife would be unable to remarry because the soldier did not return from battle and there were no witnesses to his fate. The conditional bill of divorce accorded her the status of a divorcee and freed her to remarry.

As, apparently, it was customary for men at war to send their wives a conditional divorce, since Uriah later died, Bathsheba retroactively assumed divorced status from the time that he set out to war. She was not forbidden to David.

גט כריתות כותב לאשתו - שאם ימות במלחמה יהא גט מיום כתיבתו והרי מת אוריה במלחמה:

He would write a bill of divorce for his wife- For if he died in war the bill would take effect retroactively from the day it was written-And it happened that Uriah [the Hittite] died in war.

כל היוצא למלחמת בית דוד גט כריתות כותב לאשתו - פי' בקונטרס שאם ימות במלחמה יהא גט משעת כתיבתו וקשה לר"ת דא"כ מאי כל היוצא אם לא מהני אלא למי שאין לו בנים ויש לו יבם ועוד דתנן במי שאחזו (גיטין עג. ושם) מה היא באותן הימים רבי יהודה אומר הרי היא כאשת איש לכל דבריה וקאי אמאי דקתני לעיל מינה הרי זה גיטך מהיום אם מתי וכן משמע בתוספתא אלמא אע"ג דאמר מהיום הויא אשת איש גמורה כדמפרש בגמרא באומר מעת שאני בעולם פירוש דהאי דאמר מהיום לא שיחול מיד אלא דעתו שיחול שעה אחת קודם מיתתו דהיינו מעת שהוא בעולם ולא אמר מהיום אלא למעוטי לאחר מיתה כלומר מאותו יום שאני בעולם יהא גט ומיהו יש לחלק בין מהיום לפירש בהדיא שיחול משעת כתיבה דע"כ משעת כתיבה קאמר שיהא גט ועוד נראה דאפי' אמר מהיום יש ליישב פי' הקונטרס דלאו דוקא פירש שאם ימות במלחמה אלא היו מתנים אם לא יחזור מן המלחמה ואגב ריהטיה נקט בקונטרס אם ימות דסתם מי שאינו חוזר מן המלחמה אינו חוזר לפי שמת אלא ה"ה אם נשבה והשתא מהיום דהכא אין שייך לומר מעת שאני בעולם כההוא דמי שאחזו אלא מהיום מיום כתיבה קאמר ואם תאמר והרי חזר אוריה ונתבטל הגט ויש לומר שהיה מתנה אם לא יחזור בסוף המלחמה והרי לא חזר לבסוף וניחא לפירוש זה הא דאמרינן בפרק הזהב (ב"מ נט. ושם) נוח לו לאדם שיבעול ספק אשת איש ואל ילבין פני חבירו ברבים ומפיק ליה מהאי מעשה דבת שבע דספק אשת איש הואי דדלמא יחזור מן המלחמה ור"ת מפרש כותב גט כריתות לגמרי בלא שום תנאי ולפי' קשה אמאי קרי לה ספק אשת איש הא הואי גרושה גמורה ואר"ת דקרי לה ספק אשת איש לפי שהיו מגרשין בצינעא שלא יהא נודע ויקפצו עליהם בני אדם לקדשם ולפי' הקונטרס קשה קצת איך בא עליה למה לא היה ירא שמא יחזור:

כל היוצא למלחמת בית דוד גט כריתות כותב לאשתו — All who go out to the wars of בית דוד would write a writ of divorce to his wife
OVERVIEW
The גמרא explained that דוד did not transgress the איסור of אשת איש with בת שבע, since all who went to wage the battles of דוד would write a גט כריתות to his wife (and that included אוריה, the [former] husband of בת שבע). There is a disagreement between רש״י and תוספות how this divorce was effective.
רש״י explained that they would give the גט with a stipulation, that if he will die in the war, the גט should be effective retroactively from the time it was written and delivered to the wife.
Tosfot has a different understanding of the process:

‘what status is she in the days between receiving the get with a stipulation and her husband dying?'
ר״י says she is like a married woman regarding everything. (therefore, it would come out that within Rashi's side, David slept with Batsheva while she was still a married woman but then retroactively was exonerated due to the stipulated get)

Tosfot has a problem with Rashi because of this and the Rabbeinu Tam explains that he would write a complete Get without any stipulations and the soldiers would divorce their wives, before going to war, then remarry them when they got back.
And the Rabbeinu Tam answered that the Gemara (Bava Metzia) refers to Batsheva as a ספק married woman since they would divorce their wives privately (without any publicity) so that it should not be known that these women are divorced, in order to prevent people from jumping at the opportunity to marry these ‘divorcees’.

For Rashi, this isn't an issue as she is considered ספק married woman because it is unclear if the stipulation in the get has retroactively taken affect yet.
Tosfot finishes with one final question on Rashi:
How was David intimate with Batsheva? Why was he not concerned that perhaps Uriah would return, the Get would then be invalid and Batsheva would be a married woman and David would have sinned?

Nevertheless, according to both Rashi and Tosfot, when David slept with Batsheva she was not a married woman, therefore we can conclude that David was not guilty of having an affair.

Proof 3 (Halachic): The Attack of the Malbim and others

שאם היתה א"א איך לקחה אחר כך לאשה והלא היא אסורה לבועל, ואיך צם והתפלל שיחיה הבן הנולד שהוא ממזר, ואיך נתקבלה תשובתו והאשה האסורה לו מדין תורה עומדת בביתו והרי זה כטובל ושרץ בידו, ואיך בחר ה' מזרע הנולד מהאשה הזאת שבט מושלים ויקרא שמו ידידיה וה' אהבו, מכל זה מבואר נגלה שבת שבע לא נאסרה על דוד, כי היוצא למלחמה בעת ההיא היה כותב גט כריתות לאשתו, כי הרוגי חרב מלחמה קרוב הדבר שישארו נשותיהם עגונות וכבולות, כי לרוב יקברו החללים בחפזה מאין איש יכיר בפרצוף פנים מי הנהרג להעיד להשיא את אשתו בפרט בעת שיגבר אויב ויקבור את החללים, ולכן תקנו בית דין של דוד שיכתבו גט לנשותיהן, או גט גמור או על תנאי, כי בשני הפנים האלה יצא דוד נקי מתלונת מהרי"א עליו, וכמו שנבאר הדבר בפי' הכתובים כל פרט ופרט. כי אם העון הראשון שחטא בא"א, ספר הכתוב כי שלח דוד וידרוש לאשה לדעת אם היא פנויה או א"א, ויאמר הלא זאת בת שבע בת אליעם אשת אוריה החתי ומזה ידע שהיא פנויה, אם מצד שהיא אשת אוריה שהלך למלחמה וידע שהניח לה גט כדרכם בעת ההיא, ואם מצד שהיא בת אליעם שהיה בן אחיתופל הגילוני יועץ דוד, ובודאי הוא היה היועץ לתקן תקנה זאת, שכל היוצא למלחמה יניח גט כריתות לאשתו, ואם כן אין ספק שהקפיד על זה בנכדו בל תשאר עגונה.

For if she had been a married woman, how could David have taken her as a wife afterward, since she would have been forbidden to her lover? How could he fast and pray for the child born to live, since it would have been a mamzer (illegitimate)? How could his repentance have been accepted if the forbidden woman remained in his house, and he would have been like one who immerses in a mikvah while holding a sheretz (impure creature)? How could God have chosen from the offspring born to this woman a ruling dynasty (of which Moshiach will come) and called his name Jedidiah (beloved of the Lord) and God loved him? From all this, it is clearly evident that Bathsheba was not forbidden to David.

As we will explain in the commentary on each specific verse, if the first sin was that he sinned with a married woman, the scripture recounts that David sent and inquired about the woman to know if she was single or married. And he was told, 'Isn't this Bathsheba, the daughter of Eliam, the wife of Uriah the Hittite?' From this, he knew that she was single, either because she was the wife of Uriah who had gone to war and he knew that he had left her a get as was customary at that time, or because she was the daughter of Eliam, who was the son of Ahithophel the Gilonite, David’s counselor, and certainly, he was the one who advised instituting this decree that everyone going to war would leave a bill of divorce for their wife. Therefore, there is no doubt that he was strict about this with his granddaughter so that she would not be left as an agunah.

וישלח דוד מלאכים ויקחה ותבא אליו שהמלאכים חקרו ע"ז, וכאשר ידעו שגרשה לקחה, וספר כי לא לבד שנזהר מאשת איש כי גם נזהר מאיסור נדה כי היא מתקדשת מטומאתה וטבלה לנדתה:

"And David sent messengers and took her, and she came to him." The messengers investigated this matter, and when they knew that she was divorced, he took her. The scripture tells us that not only did David avoid the sin of being with a married woman, but he also avoided the prohibition of being with a menstruating woman, as she was purifying herself from her impurity and had immersed (in a mikvah) from her menstruation.

Be'er HaGolah, Well 5 10:1-3
Summary
the Maharal goes out of his way to write that David did not sin with a married lady here. The Maharal proves this from the fact that David is called a true servant of Hashem, as well as the fact that (unlike when Shaul sinned) the kingship was not taken away from David after the Batsheva incident.
Rav Avigdor Nevenzahl
If David really took a married lady wouldn’t it have made sense for David to try and cover up his actions? Yet David sent messengers to fetch Batsheva for him in the first place, and he publicly prayed for their child to survive - he makes no effort to cover-up this act whatsoever. So even a simple (thinking) reading of the pesukim shows us that Dovid didn’t commit adultery here.

Proof 4 (Hashkafic) - even if we know David’s actions were halachically sound, we now need to approach the harder part of our task; what were David’s motives here in a moral sense?

אמר רב יהודה אמר רב לעולם אל יביא אדם עצמו לידי נסיון שהרי דוד מלך ישראל הביא עצמו לידי נסיון ונכשל אמר לפניו רבש"ע מפני מה אומרים אלהי אברהם אלהי יצחק ואלהי יעקב ואין אומרים אלהי דוד אמר אינהו מינסו לי ואת לא מינסית לי אמר לפניו רבש"ע בחנני ונסני שנאמר (תהלים כו, ב) בחנני ה' ונסני וגו' אמר מינסנא לך ועבידנא מילתא בהדך דלדידהו לא הודעתינהו ואילו אנא קא מודענא לך דמנסינא לך בדבר ערוה מיד (שמואל ב יא, ב) ויהי לעת הערב ויקם דוד מעל משכבו וגו' אמר רב יהודה שהפך משכבו של לילה למשכבו של יום ונתעלמה ממנו הלכה אבר קטן יש באדם משביעו רעב ומרעיבו שבע (שמואל ב יא, ב) ויתהלך על גג בית המלך וירא אשה רוחצת מעל הגג והאשה טובת מראה מאד בת שבע הוה קא חייפא רישא תותי חלתא אתא שטן אידמי ליה כציפרתא פתק ביה גירא פתקה לחלתא איגליה וחזייה מיד (שמואל ב יא, ג) וישלח דוד וידרוש לאשה ויאמר הלא זאת בת שבע בת אליעם אשת אוריה החתי וישלח דוד מלאכים ויקחה ותבא אליו וישכב עמה והיא מתקדשת מטומאתה ותשב אל ביתה והיינו דכתיב (תהלים יז, ג) בחנת לבי פקדת לילה צרפתני בל תמצא זמותי בל יעבר פי אמר איכו זממא נפל בפומיה דמאן דסני לי ולא אמר כי הא מילתא

Rav Yehuda says that Rav says: A person should never bring himself to undergo an ordeal, as David, king of Israel, brought himself to undergo an ordeal and failed. David said before God: Master of the Universe, for what reason does one say in prayer: God of Abraham, God of Isaac, and God of Jacob, and one does not say: God of David? God said to David: They have undergone ordeals before Me, and you have not undergone an ordeal before Me. David said before Him: Examine me and subject me to an ordeal, as it is stated: “Examine me, Lord, and subject me to an ordeal; try my kidneys and my heart” (Psalms 26:2). God said to him: I will subject you to an ordeal, and I will perform a matter for you that I did not perform for the Patriarchs, as for them, I did not inform them of the nature of the ordeal, while I am informing you that I will subject you to an ordeal involving a matter of a married woman, with whom relations are forbidden. Immediately, it is written: “And it came to pass one evening that David rose from his bed” (II Samuel 11:2).

The verse states: “And he walked upon the roof of the king’s house; from the roof he saw a woman bathing, and the woman was very fair to look upon” (II Samuel 11:2). Bathsheba was shampooing her head behind a beehive, which concealed her from sight. Satan came and appeared to David as a bird. David shot an arrow at the bird, the arrow severed the beehive, Bathsheba was exposed, and David saw her.

Freddie: In other words, the Satan made sure that Dovid would sin by employing various tactics to achieve this ends. And Hashem consented in order to teach the power of Teshuva to the people. This is also why Hashem gets so angry at him. His request for a test triggered the entire Batsheva episode, which is why he was shouted at by Hashem.

Be'er HaGolah, Well 5 10:1-3
The Maharal writes that David sinned in thought as opposed to in action. David did not take the necessary precautions in making sure everything was halachically acceptable here. Yes, Batsheva was permitted to him because of her divorce. But (according to Rashi’s view above), when David had relations with Batsheva he was risking Uriah coming back home from the front and consequently rendering the divorce retroactively invalid - thus turning David’s act into adultery. True that Uriah did eventually not return home and the divorce went through, meaning that Batsheva was not a married lady at the time she had relations with David. But David should have waited and avoided any risks. Therefore, the root of David’s wrongdoing here (and the reason he was Divinely berated) was because he did not take enough care regarding the potential prohibitions here.
Freddie: The reason why he didn't take enough care are discussed by Rav Avigdor Nevenzahl (Sichos al HaTorah, Bereishis sichah 36) and Rav Tzvi Veisfish (Dibros Tzvi, ma’amar 6); both are based on Gemaras

דרש רבא מאי דכתיב (תהלים לח, יח) כי אני לצלע נכון ומכאובי נגדי תמיד ראויה היתה בת שבע בת אליעם לדוד מששת ימי בראשית אלא שבאה אליו במכאוב וכן תנא דבי רבי ישמעאל ראויה היתה לדוד בת שבע בת אליעם אלא שאכלה פגה

Bathsheba, daughter of Eliam, was destined for David since the six days of creation, but he partook of her, before the appointed time. David would have ultimately married her in a permitted manner after the death of Uriah.

This is proved by the fact they were destined to have Solomon, the future King and who's lineage Moshiach will come from

(א) וידרש לאשה. דרש לאנשי ביתה בעד האשה מי היא אם היא בת שבע בת אליעם:

And he searched for a woman - [David] went inquiring to the people of her house in favour of the woman. Who is she? Is she Batsheva.

David knew who Batsheva was and that they were soulmates, hence why he so eagerly goes looking for her.

If so, why did Hashem berate David so much?

Rav Avigdor Nevenzahl
Rav Nevenzahl writes that Hashem’s criticism of David was because of the chillul Hashem caused by David’s actions. David should have realised that people would misconstrue what he did in mistakenly thinking that he committed adultery; thus creating a chillul Hashem as the king of Israel.

So now we know that David's sin was not with Batsheva and was rather with something else. But what was this sin?

(ה) אֲשֶׁ֨ר עָשָׂ֥ה דָוִ֛ד אֶת־הַיָּשָׁ֖ר בְּעֵינֵ֣י יְהֹוָ֑ה וְלֹא־סָ֞ר מִכֹּ֣ל אֲשֶׁר־צִוָּ֗הוּ כֹּ֚ל יְמֵ֣י חַיָּ֔יו רַ֕ק בִּדְבַ֖ר אוּרִיָּ֥ה הַֽחִתִּֽי׃

(5) For David had done what was pleasing to GOD and never turned throughout his life from all that had been commanded him, except in the matter of Uriah the Hittite.

״אֵת אוּרִיָּה הַחִתִּי הִכִּיתָ בַחֶרֶב״ — שֶׁהָיָה לְךָ לְדוּנוֹ בְּסַנְהֶדְרִין וְלֹא דַּנְתָּ.

That which is written: “Uriah the Hittite you have smitten with the sword,” means that you could have judged him before the Sanhedrin as one guilty of treason against the throne, and you did not judge him in that manner. Instead, you had him executed in a manner that deviated from the generally accepted principles of judgment.

מַאי טַעְמָא — מוֹרֵד בַּמַּלְכוּת הֲוָה. דַּאֲמַר לֵיהּ: ״וַאדֹנִי יוֹאָב וְעַבְדֵי אֲדֹנִי עַל פְּנֵי הַשָּׂדֶה חֹנִים״.

What is the reason that David was not liable for the death of Uriah? Because Uriah was a traitor against the throne. As he said to David: “And my lord Joab and the servants of my lord are encamped in the open fields” (II Samuel 11:11). In the presence of the king, one may not refer to another as his lord. Doing so is treason.

(ח) כָּל הַמּוֹרֵד בְּמֶלֶךְ יִשְׂרָאֵל יֵשׁ לַמֶּלֶךְ רְשׁוּת לְהָרְגוֹ. אֲפִלּוּ גָּזַר עַל אֶחָד מִשְּׁאָר הָעָם שֶׁיֵּלֵךְ לְמָקוֹם פְּלוֹנִי וְלֹא הָלַךְ אוֹ שֶׁלֹּא יָצָא מִבֵּיתוֹ וְיָצָא חַיָּב מִיתָה. וְאִם רָצָה לְהָרְגוֹ יֵהָרֵג. שֶׁנֶּאֱמַר (יהושע א יח) "כָּל אִישׁ אֲשֶׁר יַמְרֶה אֶת פִּיךָ".

(8) Anyone who rebels against a king of Israel may be executed by the king.
Even if the king orders one of the people to go to a particular place and the latter refuses, or he orders him not to leave his house and he goes out, the offender is liable to be put to death. The king may execute him if he desires, as Joshua 1:18 states: 'Whoever rebels against your command ... shall be put to death."

So why would Hashem want the Torah to be written in such a way that it seems to the average reader like David has committed such an atrocious sin?

ועוד ידענו כי כל עון קטן וגדול כנגד העושה על כן העון הקל לגדול יקרא גדול.

Furthermore, we know that the personality of the individual is taken into account when his sins are considered, be they major or minor transgressions. Therefore, a minor sin committed by a great personality is considered a major transgression.

(כח) שאמר משיח צדקנו (תהלים נא) כי פשעי אני אדע וגו', עם היות אמרו רז"ל כל האומר דוד חטא אינו אלא טועה, אעפ"כ מפני שהיתה לו קצת שגגה היה שם חטאו נגדו תמיד והיה דואג ומצטער עליהם כמו שאמר כי עוני אגיד אדאג מחטאתי, עם היות שלא חטא החטא הנראה וכל האומר דוד חטא אינו אלא טועה:

(כט) ואמנם צריך ביאור שנכתב בפשט הכתוב עון בת שבע כאלו דוד חטא, שדרך הכתובים לכסות השגגות ולהעלימם, כאמרם ז"ל התורה כסתו ואתה מגלה אותו, וא"כ היאך הציע הכתוב ענין, בת שבע ואטוריה בענין שיראה שחטא חטא עצום:

(ל) אבל התשובה בזה, כי הגלוי והסתום בעיניו הם עקרים גדולים לבעלי תשובה, וכמו שאמרו ז"ל, אם חטא יחיד אומר לו כלך אצל יחיד. ולכן הציע הכתוב זה כאלו חטא חטא גדול ועצום, שאותו המעט לדוד שמורים בו רז"ל שחטא היה נחשב לו כמו שיהיה נחשב לאדם אחר שחטא כל מה שיורה עליו פשט הכתוב, והודיע הכתוב כי גם כשיחטא אדם חטא עצום שיתכפר לו כמו שנתכפר זה העון לדוד, עם היותו נראה עצום מפשטי הכתובים, ושהיה יותר ראוי דוד ליענש כפי גודל צדקו, ושהקב"ה מדקדק עם סביביו כחוט השערה, כמו שראינו בענין משה רבינו ע"ה יען לא האמנתם בי, ובאו רז"ל והזהירונו כפי קבלתם האמתית שדוד לא חטא החטא שיורו עליו פשטי הכתובים. ומזה נלמד דברים רבי התועלת ג"כ, שצריך לבעל תשובה לשום חטאיו נגד עיניו תמיד, שהרי אנו רואים דוד שלא חטא על דרך האמת אעפ"כ היה אומר וחטאתי נגדי תמיד, לכן כל אדם ראוי שיתבונן בענינו בשעות ידועות וידקדק אחרי פרטי כל מעשיו כדי שישוב אל ה' בתשובה שלמה.

(28) For we see our righteous anointed one [David] to have said (Psalms 51:5): "For I know my offenses and my sin is constantly before me" — in spite of our sages' having said (Shabbath 55b): "All who say that David sinned are mistaken." Notwithstanding this, because there was some inadvertent element of sin, he placed it constantly before his eyes and was worried and afflicted by it, as it is written (Psalms 38:19): "For I will declare my transgression; I will worry over my sin" — though he did not commit the ostensible sin and though "all who say that David sinned are mistaken."

(29) However, it should be explained why the sin with Batsheva is written down plainly, as if David actually sinned, why does Scripture describe the episode of Batsheva and Uriah in such a way as to make it appear that David was guilty of a blatant sin?

(30) It is for this reason that Scripture portrays David as having committed an awesome sin - For the minor transgressions our sages acknowledge in David are, in his case, equivalent to the major sins of an ordinary person as suggested by the plain meaning of the verses. Scripture thereby teaches us that even grievous sins can be atoned for upon genuine repentance, just as David was granted atonement despite the severe nature of his sin according to the plain interpretation of the text. His greater liability to punishment stems from his exceptional righteousness and the Holy One's meticulous scrutiny of those closest to Him. And our sages came and enlightened us according to their true tradition that David did not commit the sin indicated by the plain meaning of the verses. And we likewise learn from this other things of great benefit, one of which is that the penitent must place his sins constantly before his eyes. For we see that David, though he did not actually sin, still said "…constantly before me." Therefore, all men should reflect upon their acts at set times and examine the details of all of their deeds in order to return to the L-rd with complete repentance.

Concluding remark

To echo Rav Nevenzahl’s closing line in his piece here, ‘in the merit of our seeing others in a favourable light, may Hashem judge us in a favourable light.’