The account in 2 Samuel 11 opens at a time the text is careful to name: the season when kings go out to battle, and David has stayed behind in Jerusalem instead. Walking on his palace roof, he sees Bathsheba bathing, sends for her, and she becomes pregnant. Her husband Uriah the Hittite is one of David's own elite soldiers, away at the siege of Rabbah, and David's attempt to cover the pregnancy by recalling Uriah for a night with his wife fails when Uriah, out of loyalty to the men still in the field, refuses to go home while they sleep in the open. David then sends orders, carried by Uriah himself, instructing his general Joab to place Uriah where the fighting is fiercest and withdraw support, guaranteeing his death.
The prophet Nathan confronts David afterward not with a direct accusation but with a story: a rich man with many flocks who takes the single lamb of a poor neighbor to feed a guest, rather than slaughtering one of his own. David, angered at the injustice, pronounces judgment on the rich man before Nathan tells him, you are the man. The rebuke is followed by consequence rather than forgiveness alone, the text records the death of the child born of the affair, read across the tradition as the direct cost of David's sin even as David himself is not further punished by the narrative.
The text names Bathsheba's own consent or resistance ambiguously; she is summoned by a king and the narrative gives her no recorded words in the encounter itself, a silence that later readers, both ancient and modern, have interpreted in sharply different ways.