(adds details, quotes)
By Wendell Roelf
CAPE TOWN, Feb 13 (Reuters) - South African President Jacob Zuma told mining companies on Thursday to improve workers' housing this year to meet a government deadline, saying Africa's largest economy could not afford more social unrest in the sector.
"We need a mining sector that works," Zuma said in his annual state of the nation address to parliament, noting mining's status as South Africa's leading earner of foreign exchange.
"Let me also remind mining companies that 2014 is the deadline for them to improve housing and living conditions of mineworkers and to achieve a number of targets," he added.
As well as provisions for better housing and worker conditions, South Africa's mining charter - Pretoria's blueprint for overhauling the industry - says mining companies have to have 26 percent black ownership by the end of the year.
Despite some reforms in the 20 years since apartheid, many miners remain part of a century-old migrant labour system that sees them living in hostels at the mines far away from their families.
Thousands of others, especially in the platinum sector, live in shanty towns close to the mines with little electricity or sanitation.
The poor living conditions are cited as a key reason for the discontent and violent strikes for higher wages that have plagued the sector for the last two years.
Companies, including the world's top platinum producer, Anglo American Platinum, have plans to build 20,000 homes within a decade and have already started converting single-sex hostels into family units.
Zuma, whose popularity has dipped in polls ahead of general elections on May 7, also touched on a recent wave of violent protests by residents of black townships unhappy with their living conditions.
In the last three months, South Africa has seen around 30 "service delivery" protests a day, but Zuma put a positive spin on the unrest, saying it was a sign of government success creating higher expectations among communities.
"When 95 percent of households have access to water, the 5 percent who still need to be provided for feel they cannot wait a moment longer," Zuma said. "Success is also the breeding ground of rising expectations."
Zuma's African National Congress, which came to power in South Africa's first democratic vote in 1994, is expected to extend its electoral dominance in May's ballot despite growing concerns over inefficiency and corruption. (Reporting by Wendell Roelf; Editing by Ed Cropley)
Our Standards: The Thomson Reuters Trust Principles.