The government should make a law saying that houseowners shouldn't keep a house empty if there's someone offering even a single rupee or yuan a year, plus paying the insurance premium to protect the homeowner from any damage done by the tenant, plus deep cleaning to restore the house to a rentable condition when the tenant leaves. A landlord cannot keep the house empty if there's at least one person offering the above, say prepaid for the next one year to protect the landlord from having to chase down non-payers. As long as someone is willing to do the above, the landlord can't keep the house empty. The landlord can, at any time, ask the tenant to move out, refunding the prorated amount that he already prepaid, provided the landlord isn't going to keep the house empty.
With this, millions of people who're homeless will suddenly find a home. Investments that have already been made will be useful to society, which should be the case to begin with.
If this policy deters investment in housing, rents will eventually rise till it again becomes sensible to invest in building houses. The market takes care of itself.
Instead of a ban, perhaps a high annual tax, say 30% of the value of the house, if it's left empty for more than a month a year.