The fire, which killed more than 70 people, has highlighted a housing crisis in a city that is one of the world's most unequal and where poverty and unemployment are widespread.
"Local government has to enforce the laws," Ramaphosa said at an ANC event.
"This has given us a wake-up call, and I have said that our cities and municipalities must now pay attention to how people live. We do encourage people to live in the inner city ...but we need to do it in accordance with our laws."
The apartment block is owned by municipal authorities, but officials said it was "invaded and hijacked" by unknown groups.
Government officials have said some of those who died may have been renting from, or were being extorted by, criminal gangs in the so-called "hijacked buildings" syndicates.
Municipal officials have said efforts to evict residents in illegally occupied buildings are often hamstrung by court orders stopping the evictions.
Ramaphosa said he has asked government ministers to look into ways of enforcing laws without violating people's rights.
The gutted building is linked to Apartheid-era government where it served as a dompas or passbook collection station to allow black South Africans to access white-owned areas of the city.
Ramaphosa said he collected his passbook at the building about 50 years ago, when he worked in the city.
Reuters, the news and media division of Thomson Reuters, is the world's largest multimedia news provider, reaching billions of people worldwide every day.Go to: https://www.reuters.com/