Uriah was a Hittite and the husband of Bathsheba, whom King David took a fancy to after he saw her bathing one day. Uriah was away fighting, and calling Bathsheba to him, David made love to her. Bathsheba became pregnant. Deciding to cover up the deed, David sent for Uriah.
When Uriah came to him, David asked him how Joab was, how the soldiers were and how the war was going. Then David said to Uriah, "Go down to your house and wash your feet." So Uriah left the palace, and a gift from the king was sent after him. But Uriah slept at the entrance to the palace with all his master's servants and did not go down to his house.
(2 Samuel 11:7-9)
David was dismayed when he found out that Uriah hadn't gone home. He made Uriah remain in Jerusalem another day, and this time got him drunk. Drunk or sober, Uriah was a conscientious soldier who did not think it right that he make merry while his compatriots were out fighting, and he once again slept at the entrance to the palace.
In the morning David wrote a letter to Joab and sent it with Uriah. In it he wrote, "Put Uriah in the front line where the fighting is fiercest. Then withdraw from him so he will be struck down and die." (2 Samuel 11:14-15)
Not realizing that he was carrying his own death warrant, Uriah handed the letter to Joab, who promptly put Uriah at a place where he knew he would face the maximum flak. Uriah the Hittite died, and the only consolation of this entire sad story is that he died without realizing the deception that was practiced against him.
Bathsheba mourned his death, but after the mourning period was over, David had her brought to his house and made her his wife. She bore David a son, but as punishment for his transgression, the child died seven days after it was born.