
A king’s wife is forbidden to marry any other man after being widowed or divorced unless she marries another king. The sages put it thus: “A king may make use of the king’s sceptre.” Therefore Abishag the Shunammite, servant of King David, was permitted to marry Solomon, because he, too, was a king. What connection was there between David and Abishag the Shunammite? David, when he was very old, was cold and neither blankets nor clothing could keep him warm. His servants suggested bringing a virgin girl before him to warm him up. After they searched the entire country they found a girl named Abishag the Shunammite: ” The young woman was very lovely; and she cared for the king, and served him; but the king did not know her [did not have sex with her]” (I Kings 1:4). Abishag asked David to marry her. David refused because he already had 18 wives and a king may not have too many wives. Abishag saw David’s words as evasion and told him: “It is because of your age; your sexual prowess has weakened and that is why you refuse to marry me. You just use excessive piety as an excuse, as though you are careful about the Torah’s laws”. The sages gave an analogy: “When courage fails the thief he become a virtuous man.” David was wounded by Abishag’s words and called Bathsheba to his room. He had sex with her 13 times to show that he still possessed sexual prowess, despite his advanced age. How do the sages know he had sex with Bathsheba 13 times? From the word count in the verse “So Bathsheba went into the chamber to the king. (Now the king was very old, and Abishag the Shunammite was serving the king.)” (I Kings 1:15; in Hebrew, this verse has 13 words.) One of the scholars, Rav Shaman son of Abba, said that it is preferable to violate the laws against seclusion with the opposite sex than to divorce a wife — since David did not divorce any of his wives to marry Abishag, yet he was secluded with her without sex, though even such seclusion is contrary to Halacha.
(Babylonian Talmud, Tractate Sanhedrin 22a)