The verdict was delivered to the men in the prison, where their closely watched six-month trial was held.
The crime sparked outrage across Pakistan, with the case regularly being discussed on TV and social media.
In December, president Arif Alvi signed off on the creation of a national sex offenders register as well as a host of tough anti-rape measures like chemical castration for some offenders in the wake of the protests.
The measures also include the establishment of fast-track courts for rape cases, which are expected to reach a verdict within four months.
Malhi and Ali were tried in an anti-terrorism court for expediency.
Prosecutors at the trial said that the two men found the victim at the side of a road while she was waiting for help after running out of fuel.
They broke a window of the locked car and dragged the woman outside, before raping her in front of her children. The men also stole money, jewellery and bank cards before fleeing.
They were tracked down using mobile phone data and arrested days after the attack. DNA samples taken from the crime scene matched that of Malhi and Ali.
Ali confessed to the crime before a magistrate and the victim identified both men at a hearing.
Neither one hired a lawyer and their state-appointed representatives have not publicly commented on the case’s verdict. Appeals or commutations are, however, likely.
The host of anti-rape measures signed into law by Pakistan’s president in the wake of the attack are currently in effect, but must pass through parliament before becoming permanent laws. The deadline is in mid-April.