Holloway prison in north London has been sold to housing association Peabody in a £81.5m deal and will now have more than 1,000 homes built on the site.
The former women's jail occupies a 10-acre site and previously held murderers Myra Hindley and Rose West.
Peabody has confirmed that 600 of the homes built will be "genuinely affordable", while the site will also include a women's centre, shops, green spaces and play areas.
The housing association has received a £41.6m loan from City Hall for the deal with the Ministry of Justice and the new properties will be built in partnership with housebuilder London Square
Labour leader Jeremy Corbyn, whose constituency the prison is based within, said the deal was good for the local community.
"For too long private developers had free rein to buy up public land and build properties that are completely unaffordable for the local community," Corbyn tweeted.
"But under a Labour Mayor and Labour council, the former Holloway Prison site will include 600 social and genuinely affordable homes."
Prisons Minister Rory Stewart was also pleased with the deal, which is part of a process to replace old prisons with new institutes better equipped to deal with prisoners and reduce reoffending.
"The sale of Holloway will help drive forward our commitment to replace ageing prisons with modern, purpose-built establishments," he said.
"I am determined to see this money reinvested to improve rehabilitation and ultimately reduce reoffending.
"We have worked closely with the local authority and others to ensure the amount of affordable housing on the site meets local needs, and I am pleased we have achieved this aim while giving good value to taxpayers."