David did not always walk perfectly. His actions were not faultless yet God's opinion of David was that he was a man after God's own heart. In II Samuel 11 and 12 God tells us of a battle in Rabbah where David sent men to war. He sent Joab, the man in charge of the entire army of Israel, and many of his mighty men but he stayed in Jerusalem. I do not see anywhere in the Word of God where David asked God how to handle this war as he did previously. He was strong, wealthy and had a huge army. He appears to be trusting more in his ability and that of his vast army and mighty men than God.
II Samuel 11
:2 And it came to pass in an eveningtide,
that David arose from off his bed, [after dining]
and walked upon the roof of the king's house:
and from the roof he saw a woman washing herself;
and the woman was very beautiful to look upon.
:3 And David sent and enquired after the woman. And one said,
Is not this Bathsheba,
the daughter of Eliam,
the wife of Uriah the Hittite?
:4 And David sent messengers,
and took her;
and she came in unto him,
and he lay with her;
for she was purified from her uncleanness:
and she returned unto her house.
:5 And the woman conceived,
and sent and told David, and said,
I am with child.
Uriah is a mighty man and faithful to David. Of the great number of people in David's army; 1,570,000 (I Chronicles 21:5) God names 100 as mighty men (II Chronicles. 23:39). Bathsheba, his wife , was very beautiful. They lived close to King David's palace, so close in fact that they could be seen by David from his rooftop and going upon one's rooftop is a common occurrence in this culture. Bathsheba knew she could be seen. Do you not know when you can be seen by your neighbors?
Now David has many wives and concubines and is in no need of companionship. However, he let his lust for this woman supercede his right judgment. Even though the king has every right to any woman in the kingdom that does not give him the right desire his neighbor's wife and to commit adultery (two of the 10 commandments), it is punishable by death (Deuteronomy 22:22).
After David learns of Bathsheba's pregnancy he tries to cover his mistake instead of admitting to his error. He calls for Uriah who is in the battle at Rabbah and asks of him the state of things. After he is done asking Uriah questions he tells him to go home. But Uriah is a faithful and noble man, he does not go into his house and sleep in his own bed and go in unto his wife while the rest of the army is at war.
II Samuel 11
:11 And Uriah said unto David,
abide in tents;
and my lord Joab,
and the servants of my lord,
are encamped in the open fields;
shall I then go into mine house,
to eat and to drink,
and to lie with my wife?
as thou livest,
and as thy soul liveth,
I will not do this thing.
Since that didn't work David gets Uriah drunk and sends him home but Uriah still does not sleep with his wife to cover up David's transgression. Now David is desperate. He sends a note to Joab by the hand of Uriah telling Joab to set Uriah up in the hottest part of the battle and then withdraw so that he is killed. Now David has orchestrated a murder.
It is troubling to see a man who walked with God get tricked and drawn of the path of righteousness. But we are all human and fallible. God gave us free will so that we may love him freely. You cannot force someone to love you, it is a conscious, deliberate act of will. David had free will to stay on course with God or let his lust overcome his desire to do the right thing. He should have turned around and walked away, take a cold shower or call for one of his wives so that he did not burn. But he didn't. We will see that this has many devastating effects.
After Uriah is killed and the news is brought back to David Bathsheba mourns and then is brought into the palace.
:27 And when the mourning was past,
David sent and fetched her to his house,
and she became his wife,
and bare him a son.
But the thing that David had done displeased the LORD.
The next event didn't happen right after the son was born to David. God's Word tells us that David's son is a child by this time; he is weaned; possibly 18 months old (12:14). Nathan the prophet knew what was going on. I am sure he wanted to advise David but he had to wait for the right time and right words so that David would receive the reproof. It took David about two years after the transgression of adultery for him to return to being meek enough to receive the reproof from God.
God told Nathan just the right words to say in order for David to humble himself before God once again:
II Samuel 12
:1 And the LORD sent Nathan unto David.
And he came unto him, and said unto him,
There were two men in one city;
the one rich,
and the other poor.
:2 The rich man had exceeding many flocks and herds:
:3 But the poor man had nothing, save one little ewe lamb,
which he had bought and nourished up:
and it grew up together with him,
and with his children;
it did eat of his own meat,
and drank of his own cup,
and lay in his bosom,
and was unto him as a daughter.
:4 And there came a traveller unto the rich man,
and he spared to take of his own flock and of his own herd,
to dress for the wayfaring man that was come unto him;
but took the poor man's lamb,
and dressed it for the man that was come to him.
:5 And David's anger was greatly kindled against the man;
and he said to Nathan,
As the LORD liveth, the man that hath done this thing shall surely die:
:6 And he shall restore the lamb fourfold,
because he did this thing,
and because he had no pity.
:7 And Nathan said to David,
Thou art the man.
Thus saith the LORD God of Israel,
I anointed thee king over Israel,
and I delivered thee out of the hand of Saul;
:8 And I gave thee thy master's house,
and thy master's wives into thy bosom,
and gave thee the house of Israel and of Judah;
and if that had been too little,
I would moreover have given unto thee such and such things.
:9 Wherefore hast thou despised the commandment of the LORD,
to do evil in his sight?
thou hast killed Uriah the Hittite with the sword,
and hast taken his wife to be thy wife,
and hast slain him with the sword of the children of Ammon.
:10 Now therefore the sword shall never depart from thine house;
because thou hast despised me,
and hast taken the wife of Uriah the Hittite to be thy wife.
:11 Thus saith the LORD,
Behold, I will raise up evil against thee out of thine own house,
and I will take thy wives before thine eyes,
and give them unto thy neighbour,
and he shall lie with thy wives in the sight of this sun.
:12 For thou didst it secretly:
but I will do this thing before all Israel,
and before the sun.
Stop and consider the words that Nathan spoke to David: "Thou art the man." This accusation is devastating. I imagine David as he sat there strong and powerful with his shoulders back and head straight and squared away until Nathan spoke the accusation. At that point his countenance changes from authority to humbleness, the shoulders drop and his head droops. David had loved God and given Him glory and danced before Him and consulted with Him. He was genuinely sorry; heavy hearted for what he had done. As Nathan continues on delivering God's message of consequences for his actions David doesn't dispute them or cast the blame elsewhere. He admits his transgression. He then has the courage to go to God and ask forgiveness and strength to stand and be joyful.
For many people this type of disloyalty to God would destroy them, the guilt would be too difficult to bear. Some people try to escape the transgression or justify the wrong and/or shift the blame (Saul & the Amalakites, I Samuel 15). It takes courage and humbleness to admit one's mistake and except the consequences. David's sons rebelled against him later on even to the point of David escaping his palace so that he was not killed. Joab also turned face; possibly because of the kings commandment to have Uriah killed. Joab probably didn't know why he was to do it but because Joab was faithful he carried out the order. The immediate consequence was the death of the son born to David and Bathsheba.
God is great at forgiving-he didn't require David's life for his transgressions because David's heart was still after God. In I Chronicles where we read about the events according to God's perspective He has written:
I Chronicles 20
:1 And it came to pass,
that after the year was expired,
at the time that kings go out to battle,
Joab led forth the power of the army,
and wasted the country of the children of Ammon,
and came and besieged Rabbah.
But David tarried at Jerusalem.
And Joab smote Rabbah,
and destroyed it.
:2 And David took the crown of their king from off his head,
and found it to weigh a talent of gold, [about 131 pounds or 59.5 kg]
and there were precious stones in it;
and it was set upon David's head:
and he brought also exceeding much spoil out of the city.
God doesn't mention David's transgression only that Joab overthrew Rabbah and brought back great spoil from the city. Bathsheba is never mention in Chronicles. God forgives David utterly because of his heart as he came to Him in humbleness and meekness. Bathsheba does play an import role in David's life later on, the next child born to her is Solomon who becomes the next king, and he is also in the Christline.
David's humbleness is set forth in Psalm 51. Listen to his requests. I encourage you to read it in it's entirety, here are a few verses:
:1 Have mercy upon me, O God,
according to thy lovingkindness:
according unto the multitude of thy tender mercies
blot out my transgressions.
:2 Wash me throughly from mine iniquity, [not thoroughly, thoroughly-inside]
and cleanse me from my sin.
:3 For I acknowledge my transgressions:
and my sin is ever before me.
:4 Against thee,
have I sinned, and done this evil in thy sight:
that thou mightest be justified when thou speakest,
and be clear when thou judgest.
:9 Hide thy face from my sins,
and blot out all mine iniquities.
:10 Create in me a clean heart, O God;
and renew a right spirit within me.
:11 Cast me not away from thy presence;
and take not thy holy spirit from me.
:12 Restore unto me the joy of thy salvation;
and uphold me with thy free spirit.
:13 Then will I teach transgressors thy ways;
and sinners shall be converted unto thee.
God's forgiveness is great. We must tend our hearts with great care and continually refresh God's Word there. David didn't want to lose his prized possession-God's spirit up on him--and he wanted God to help him cleanse his heart and return the joy he once had. God can help us keep our hearts clean-keep our heads in His wonderful matchless Word.