Said Rabbi Abba: It has been handed down by tradition that Bathsheba was predestined from the creation of the world
to become the wife of David. If so, how was it that the Holy One permitted before becoming so that she should be the spouse of Uriah the Hittite?"
Said Rabbi Simeon in reply: "The ways and designs of the Holy One are such that even when a woman is predestined to be the wife of a certain individual, he does not debar her from marrying before meeting and becoming acquainted with him who is fore-ordained to he her husband. When this occurs, the first husband disappears in order that she may become united with her future partner in life. God could prevent the first marriage by causing the death of one who wished to marry a woman destined to become the bride of another man, but it is neither the will nor the pleasure of the Holy One that anyone should die before the time fixed for his departure out of earth life. Such was the mystery in connection with Uriah and Bathsheba before she became the wife of David. Ponder well and meditate upon this exposition, and you will become convinced of its correctness. It may be asked why was the Holy Land given in patrimony to the Canaanite before the advent of the Israelites, but on reflection over what I have just stated, you will find the explanation by following the same line of exposition I have followed in respect to the marriage of David with Bathsheba. Notwithstanding David's confession and penitence, the consequences of his sins and especially those in connection with his marriage with Uriah's wife and the remembrance of them were always with him, nor was he even able to divest and rid himself of the fear that they would be visited upon him in times of danger and suffering. In the words 'My sin is ever before me' there is an occult allusion to the horned new moon, symbol of the impurity existent in the world that would only disappear on the advent of Solomon, when it would again attain its full, and the earth give forth a sweet perfume and Israel live in peace and security, as it is written,73b 'Israel shall dwell safely every man under his own vine and fig tree.'1 Kings 4:25 (KJV)
1 Kings 5:5 (JPS) Notwithstanding this, the evidences and remains of the sins of former times were not altogether effaced and obliterated in the reign of Solomon, but will continue to exist until the coming of Messiah into the world at the time appointed, as it is written, 'And I will cause the unclean spirit to pass out of the land.'" (Zach. XIII. 2).