I’ve often seen Gospel Doctrine lessons end up debating whether David or Bathsheba was to “blame” for this. The answer is both; to be clear, while the vast majority of responsibility lies with David, Bathsheba is probably not completely blameless. Here, though, the text is not interested in exploring how Bathsheba managed to engaged in a ritual bath (normally a full-immersion miqveh) in a way that was visible to David. These tended to not be on rooftops. Literarily,
The character of Bathsheba and her motivations are particularly puzzling. The author gives no clues to the emotions of a woman who commits adultery, becomes pregnant, loses her husband, and marries her royal lover. From a literary perspective, according to Berlin, Bathsheba is simply an agent, a person necessary for the plot, and not a full-fledged character. Since 2 Samuel 11 is a story about David’s adultery, and since such a story requires a married woman, Bathsheba fulfills this function.- “Bathsheba” Anchor Bible Dictionary
Bathsheba later shows that she is politically ambitious as well as clever, leading some scholars to suggest that in this first episode, “David and Bathsheba are co-conspirators in a political scheme to marry.” (Ibid.)
But clearly, regardless of Bathsheba’s emotions or intentions here, this is the ancient Near East and David is the King. That is an extremely asymmetrical divide of social power between the man and woman in this relationship. David is the one who is not where he should be (at the front), and David is the one who pursues the relationship and indeed, the only one with power to do so.