Question: Why did David order Uriah to the front lines of battle?
About the article "Bathsheba", section "Biblical narrative".

Candidate passages:
The meaning of the Hebrew form of the name "Bathsheba" is "daughter of the oath", "bat" meaning daughter.
The second part of the name appears in as "shua" (signifying "wealth") (compare ).
Bathsheba was the daughter of Eliam (, who is called Ammiel in ).
Her father is identified by some scholars with Eliam mentioned in as the son of Ahithophel, who is described as the Gilonite.
(See King David's Warriors.
)Bathsheba was the wife of Uriah the Hittite, and afterward of David, by whom she gave birth to Solomon, who succeeded David as king.
(United Kingdom of Israel and Judah).
The story of David's seduction of Bathsheba, told in , is omitted in Chronicles.
The story is told that David, while walking on the roof of his palace, saw Bathsheba, who was then the wife of Uriah, having a bath.
He immediately desired her and later made her pregnant.
In an effort to conceal his sin, David summoned Uriah from the army (with whom he was on campaign) in the hope that Uriah would re-consummate his marriage and think that the child was his.
Uriah was unwilling to violate the ancient kingdom rule applying to warriors in active service.
Rather than go home to his own bed, he preferred to remain with the palace troops.
After repeated efforts to convince Uriah to have sex with Bathsheba, the king gave the order to his general, Joab, that Uriah should be placed in the front lines of the battle, where it was the most dangerous, and left to the hands of the enemy (where he was more likely to die).
David had Uriah himself carry the message that ordered his death.
After Uriah was dead, David made the now widowed Bathsheba his wife.
David's action was displeasing to the Lord, who accordingly sent Nathan the prophet to reprove the king.
After relating the parable of the rich man who took away the one little ewe lamb of his poor neighbor (II Samuel 12:1-6), and exciting the king's anger against the unrighteous act, the prophet applied the case directly to David's action with regard to Bathsheba.
The king at once confessed his sin and expressed sincere repentance.
Bathsheba's child by David was struck with a severe illness and died a few days after birth, which the king accepted as his punishment.
Nathan also noted that David's house would be cursed with turmoil because of this murder.
This came to pass years later when one of David's much-loved sons, Absalom, led an insurrection that plunged the kingdom into civil war.
Moreover, to manifest his claim to be the new king, Absalom had sexual intercourse in public with ten of his father's concubines, which could be considered a direct, tenfold divine retribution for David's taking the woman of another man.
(II Samuel 16:20–23) In David's old age, Bathsheba secured the succession to the throne of her son Solomon, instead of David's eldest surviving son Adonijah.
Some commentators have written that Bathsheba may have written at least part of Proverbs 31 as suggested by the postulated connections between King Lemuel aka King Solomon.
The story of David's adultery sets up the context for the penitential Psalm 51 (50), also known as "Miserere" ("Have mercy on me, O God").
David committed adultery with Bathsheba, the wife of Uriah the Hittite.
Bathsheba became pregnant.
David sent for Uriah, who was with the Israelite army at the siege of Rabbah, so that he could sleep with his wife and conceal the identity of the child's father.
Uriah refused to do so while his companions are in the field of battle and David sent him back to Joab, the commander, with a message instructing him to ensure that Uriah died in battle.
David married Bathsheba and she bore his child, "but the thing that David had done displeased the Lord."
The prophet Nathan confronted David, saying: "Why have you despised the word of God, to do what is evil in his sight?
You have smitten Uriah the Hittite with the sword, and have taken his wife to be your wife."
Nathan presented three punishments from God.
First, that the "sword shall never depart from your house" (2 Samuel 12:10); second, that "Before your very eyes I will take your wives and give them to one who is close to you, and he will sleep with your wives in broad daylight", and finally, that "the son born to you will die" ().
David repented, yet David's child died.
David left his lamentations, dressed himself, went to the House of the Lord and worshiped, and then returned home to eat.
His servants asked why he wept when the baby was alive, but ended his mourning when the child dies.
David replied: "While the child was still alive, I fasted and wept.
I thought, 'Who knows?
The may be gracious to me and let the child live.'
But now that he is dead, why should I fast?
Can I bring him back again?
I will go to him, but he will not return to me."
According to Second Samuel, King David was tempted upon seeing Bathsheba bathe in her courtyard from the roof of his palace.
He had her brought to his chambers and had sex with her, resulting in a pregnancy.
Informed that her husband was Uriah, David summoned Uriah from battle to meet him, suggesting that he go home and "wash his feet," meaning to spend time at home and attend to his wife.
Uriah refused, claiming a code of honor with his fellow warriors while they were in battle.
It was common for warriors in preparation for battle to abstain from sex, as a practice of discipline.
After repeatedly refusing to see his wife Bathsheba, David sent Uriah to his commanding officer Joab with a letter that ordered to put Uriah in the front of the battle and have the soldiers move away from him so that he would be killed.
Despite Uriah's status as one of David's mighty men, British rabbi Jonathan Magonet observes that Uriah refers to Joab, not David, as 'my lord (or commander)' (2 Samuel 11:11).
Joab is, Magonet notes, a kingmaker who despatches ruthlessly his own military rivals, Abner and Amasa.
He is sufficiently powerful that David, on his deathbed, advises Solomon to arrange his death (1 Kings 2:5 - 6).
This prompts Magonet to speculate that David saw some deeper political threat from Joab through his entanglement with Uriah's wife. 
Uriah the Hittite (Hebrew: אוריה החתי) was a soldier in King David’s army mentioned in the Second Book of Samuel.
He was the husband of Bathsheba, and was murdered by order of David by having the soldiers retreat from him in battle.
Uriah's wife was pregnant by King David through an adulterous affair.
Although under David's order to return home and see his wife, Uriah repeatedly refused to leave his post or leave the King's presence to see her.
Contact between the couple could have hidden the adulterous nature of her pregnancy by David.
As a result of this murder, David was rebuked by the prophet Nathan; furthermore, later turmoil in David's household and throughout the kingdom of Israel, including the death of Bathsheba's baby and the insurrection of prince Absalom, was contemporarily explained as punishment for the sins of adultery and murder. 
David's mighty men were a group of his best thirty-seven fighters (later expanded to around eighty).
Although the lists of his mighty men (2 Samuel 23:8-39 & 1 Chronicles 11:10-47) are given after David has become king, many of them may have been the loyal followers who stayed with him when he was fleeing King Saul.
At the very least, they fought side-by-side with him.
Uriah's closeness to David is illustrated by how closely he lived to the palace, and his position as one of the mighty men at the front battle lines allowed David to formulate and carry out his plot.