The men, Abid Malhi and Shafqat Hussain, were convicted of gang rape, kidnapping, robbery and terrorist offenses according to a written court order in the eastern city of Lahore.
The woman was raped on the side of a highway in the eastern province of Punjab after her car ran out of fuel while driving with her two children in September.
According to the Karachi-based group War Against Rape, less than 3% of sexual assault or rape cases lead to conviction in Pakistan.
The two convicted men were also sentenced to life imprisonment, a fine and property confiscation, Rauf Wattoo, a prosecutor involved in the case, told Reuters.
“The survivor had identified the convicts twice during the prison identification parade and while filing her statement in court,” said another prosecutor, Waqar Bhatti.
Human rights activists have called for an end to a culture they say regularly blames victims of sexual assault. After the rape in September, a senior police officer publicly wondered why the woman was driving alone at night with her children.