Sometimes, a lot of people will go homeless for no reason. For example, I have about 20 000 people and 18 000 of them will go homeless all of the sudden. I think this mostly happens when I place a building that houses colonists but it has happened out of doing nothing too.
(They do go back to their homes after a while)
If you move, sell, or destroy houses, the colonists inside will be homeless for a short time. Or if you're close to the limit of colists, some take a while to find a home