The men, Abid Malhi and Shafqat Hussain, were convicted of gang rape, kidnapping, robbery and terrorism, according to a written order issued by a judge in the eastern city of Lahore.
The woman was raped on the side of a highway in eastern Punjab province after her car ran out of fuel while driving her two children in September.
Less than 3% of sexual assault or rape cases result in a conviction in Pakistan, according to the Karachi War Against Rape group.
The two convicted men were also sentenced to life in prison, fined and their property confiscated, Rauf Wattoo, a public prosecutor involved in the case, told Reuters.
“The survivor twice identified the convicts during the prison identification parade and while recording her statement before the judge,” said another prosecutor, Waqar Bhatti.
Rights activists have called for an end to a culture they say they regularly accuse victims of sexual assault of. After the September rape, a senior police official publicly asked why the woman was driving alone with her children at night.