It's funny you bring that up: employers need to be careful about asking where employees live, out of concern of giving the impression that a candidate's selection depends on where they live or are willing to live. You can ask "can you arrive at the job site reliably every day at 8:45AM", but you cannot safely ask "do you live in the Chicago metro area".
In practice, people do casually ask where candidates live (usually to find out if they require relocation), but companies also don't tend to select only employees willing to live in a dormitory.
Requiring employees to work at a particular job site is uncontroversial; in fact, it's overwhelmingly the norm for all employment. The same thing is absolutely not true of requiring employees to live at a particular location.