Offering people the chance to work from home is fine, but requiring them to is a change in contract.
If agreed that’s fine, if not it’s the same as every other contractual change.
Can be changed, but needs negotiation, usually with unions if they are recognised in the workplace.
Struggle to see direct discrimination from your example, as it needs to relate to a protected characteristic, but at a push you might argue it discriminated against age as younger people would be more likely to living with others like parents or in smaller shared flats etc...seems tenuous though and unlikely to fly I don’t think (if you could prove a particular background lived in worse accommodation maybe, but doubt it would carry either)
Most contracts now (Ours do) include a clause say we can require you to work from any other location with an x mile radius or from your home when required.