In the case of David this passage [D&C 132:37] refers at least in part to Bathsheba, wife of Uriah. David committed adultery with Bathsheba and then arranged for Uriah to be killed in battle. Afterwards David married Bathsheba. (See 2 Samuel 11.) David’s story is one of tragedy and a lesson to all of God’s children, because he went from the height of favor with God to the depth of wickedness. He had all that this life could offer, but through sin he lost exaltation and the right to be eternally with his Father in Heaven. Elder Bruce R. McConkie explained:
“As to the fact that the sealing power cannot seal a man up unto eternal life if he thereafter commits murder and thereby sheds innocent blood (not in this case the blood of Christ, but the blood of any person slain unlawfully and with malice) the Prophet says:
‘A murderer, for instance, one that sheds innocent blood, cannot have forgiveness. David sought repentance at the hand of God carefully with tears, for the murder of Uriah; but he could only get it through hell; he got a promise that his soul should not be left in hell.
“‘Although David was a king, he never did obtain the spirit and power of Elijah and the fullness of the priesthood; and the priesthood that he received, and the throne and kingdom of David is to be taken from him and given to another by the name of David in the last days, raised up out of his lineage.’ (Teachings, p. 339) Thus, even though a man’s calling and election has been made sure, if he then commits murder, all of the promises are of no effect, and he goes to a telestial kingdom (Rev. 21:8; D & C 76:103), because when he was sealed up unto eternal life, it was with a reservation. The sealing was not to apply in the case of murder.” (Doctrinal New Testament Commentary, 3:347) — Doctrine and Covenants Student Manual, p. 333
David’s story is one of the saddest in all the history of God’s dealings with men. A man after the Lord’s own heart – a mighty and valiant king, prophet, and patriarch – he fell into sin and lost his hope of eternal life. Peter here confirms (Acts 2:27-34) David’s prophetic powers, but announces that Israel’s great king had not been resurrected as were all the holy prophets. The saints, those who had lived a celestial law form Adam to Christ, were with the Lord in his resurrection. (Bruce R. McConkie, Doctrinal New Testament Commentary, Vol. I, pp. 847-848)
Though David was not one of these, he received the promise that his soul would not be left in hell, that is, he would not be a son of perdition, he would not be cast out eternally with the devil and his angels. Rather, when death and hell deliver up the dead which are in them, he shall come forth from the grave and receive that inheritance which he merits. (See Rev. 20:11-15)
David could not gain a remission of his sins in this life. “A murderer for instance, one that sheds innocent blood, cannot have forgiveness,” Joseph Smith said, meaning that such a person cannot come into the Church though baptism and become an heir of the celestial kingdom. “David sought repentance at the hand of God carefully with tears, for the murder of Uriah,” the Prophet continued, “but he could only get it through hell: he got a promise that his soul should not be left in hell.” (Teachings, p. 339) Thus it is that the revelation says that Israel’s once favored king “hath fallen from his exaltation, and received his portion.” (D&C 132:39) — Elder Bruce R. McConkie, Doctrinal New Testament Commentary, Vol. II, p. 39