Emergency services took 10 children and four adults to hospital after the blaze started around 2:30 am (0030 GMT) in the basement of the five-storey building in the northwestern city of Bremen.
The fire brigade responded with 70 personnel and 27 vehicles, using ladders to rescue some inhabitants from the smoke-filled building through windows.
Police said some 50 people had to be resettled in another shelter.
The fire was thought to have started in a garbage bin in the cellar, for as yet unknown reasons, they said in a statement. Officers were interviewing witnesses.
Germany, the EU's most populous country, has taken in over one million asylum seekers since 2015, about half of them from war-torn Syria, Iraq and Afghanistan.
The influx has sparked both a large wave of volunteerism and an ugly anti-foreigner backlash that has seen a spate of hate crimes targeting migrants and refugees.