Tehran prosecutor Saeed Mortazavi was quoted as saying, "Workers were sleeping in the building, which collapsed in the morning."
Initial reports suggested three people had died in the collapse, but the death toll has now risen to 19.
The workers had been recovering construction materials from the apartment block, which had been earmarked for demolition. The original foundations were reported to be 17 years old but new storeys had been added.
"This building was first authorised to have three storeys but the constructor got a new permit and added a few more and built an adjacent building whose foundation was not connected to the old one," Mr Mortazavi was quoted as saying.
The building, in the Sa'adatabad district, had already been evacuated of residents after it was found that a foundation column had started to "wilt", reports said.
Five people have so far been arrested, including the engineers overseeing the construction, the contractor and the builder. Mr Mortazavi said they could expect "a harsh punishment".
Concern has been expressed in Tehran over the quality of apartment blocks built in recent years to cope with the capital's rising population levels.
Building standards, said the report, are not always rigorously adhered to as developers try to achieve a maximum yield from new buildings in the shortest possible time.
The concern is particularly acute as the densely-populated capital sits on a major geological fault line.