The defendants are accused of burning the girl's body to conceal the crime and shooting dead her sister and parents.
Richard Anderson, a lieutenant colonel and the military judge presiding over the court-martial, told Barker: "This court sentences you to be confined for the length of your natural life, with the eligibility of parole."
'Angry and mean'
Barker, 23, showed no reaction when the sentence was delivered.
Barker had earlier wept during his closing statement, accepting responsibility for the rape and killings and said violence he encountered left him "angry and mean" when it came to Iraqis.
Weeping, Barker said: "I want the people of Iraq to know that I did not go there to do the terrible things that I did.
"I want the people of Iraq to know that I did not go there to do the terrible things that I did"
James Barker, convicted US marine
Send us your views
"I do not ask anyone to forgive me today."
He said: "To live there, to survive there, I became angry and mean. The mean part of me made me strong on patrols. It made me brave in fire fights.
"I loved my friends, my fellow soldiers and my leaders, but I began to hate everyone else in Iraq."
During the testimony, his fellow soldiers described weeks with little support and sleep while manning distant checkpoints.
William Fischbach, the lead prosecutor, told the court that such conditions were no excuse for Barker, who led the group to the family's house, and that no one deserved such unspeakable horrors.
Holding up pictures of the crime scene, Fishbach said: "This burned-out corpse that used to be a 14-year-old girl never fired bullets or lobbed mortars.
"Society should not have to bear the risk of the accused among them ever again."
Military prosecutors declined to comment after Barker's sentencing. The three other soldiers have yet to be tried.
Paul Cortez, 24, and Jesse Spielman, 22, members of the 101st Airborne Division along with Barker, have also been charged.
Cortez has deferred entering a plea, and Spielman will be prosecuted in December.
Bryan Howard, 19, also deferred entering a plea at his prosecution in October.
Private Steven Green, 21, pleaded not guilty last week to civilian charges including murder and sexual assault.
He was discharged from the Army for a "personality disorder" before the allegations became known, and prosecutors have yet to say whether they will pursue the death penalty against him.
In earlier testimony, Barker described in detail how he raped Abeer Qassim al-Janabi with Cortez and Green before Green killed her and her family.
He said: "Cortez pushed her to the ground. I went towards the top of her and kind of held her hands down while Cortez proceeded to lift her dress up.
"Around that time I heard shots coming from a room next door."
Howard, Cortez and Spielman could face the death penalty if convicted.
Cortez and Spielman are both being held in confinement, and Howard is restricted to post.