Places like Vancouver, Canada do this through a vacancy tax. It doesn't appear to do much as those leaving the unit vacant are the extreme wealthy and just factor in the tax to the cost of maintaining the house.
I always love this counterargument to penalty based enforcement in these sorts of situations. "The penalties don't seem to have the desired effect!" Then the natural conclusion is that they aren't high enough.