The figure is double what is currently being provided.
Undertaking such a programme would cost Â£700m a year, experts commissioned to look into the issue found.
Housing charity Shelter has urged all political parties to pledge to meet the 12,000 homes target in their Holyrood election manifestos.
The Scottish government currently has a target of building 6,000 affordable homes per year.
A report - Affordable Housing Need in Scotland - was carried out by a team from the Centre for Regional Economic and Social Research at Sheffield Hallam, Sheffield University and the University of St Andrews.
It was commissioned by Shelter Scotland, the Chartered Institute of Housing (CIH) Scotland and the Scottish Federation of Housing Associations (SFHA).
The independent report - which claims to be the first in-depth investigation into Scotland's total housing need for 10 years - calls for the biggest house building programme since the 1970s.
The Scottish government is to consider the report but said it is "already delivering a huge boost to affordable housing provision", with 30,000 properties to be completed by the end of the life of the current parliament in 2016.
Graeme Brown, director of Shelter Scotland, said: "The 12,000-a-year target for new affordable homes is the minimum level required to tackle Scotland's housing crisis.
"We are calling on all political parties in Scotland to acknowledge there is a crisis by making the building of new affordable homes a priority in their manifestos for the forthcoming Holyrood elections and use the 12,000 target as a benchmark for their ambitions.
"Politics is about making choices and we have simply got to do more to reduce homelessness in Scotland."
SFHA chief executive Mary Taylor said: "The research provides evidence of the scale of need. Scottish ministers are already considering recommendations from the subsidy review group earlier this summer which showed a need for increased subsidy."
A Scottish government spokeswoman said: "We are working closely with all sectors to promote the construction of new homes, support jobs in the construction industry and inclusive growth in the wider economy."
At least 12,000 affordable homes need to be built in Scotland each year for the next five years, according to three leading housing organisations.