This question is inspired by a question on Workplace Stack Exchange in which an employee of a German research institute was told by their boss's secretary:
Hey, we pay you one of the top salaries in our research group, but you live in a shared apartment in a remote district. It's obvious that if you spend 3-4 hours a day commuting and share a flat with a bunch of people, your performance at work is bound to be suboptimal, even though we have no specific complaints about your performance. Your work is critically important to our group, so we want to get the most from you and expect you to rent a comfortable apartment solely for yourself and close to work. That's why we pay you that much and your salary is supposed to cover this.
There are some other details in the secretary's message regarding dress code and eating together with colleagues, but for this question I want to focus only on the matter of how far away the employee lives and whether they live with other people or alone.
Given that there are admittedly no issues with the employee's performance, would it be legal for the employer to decline to renew the employee's fixed term contract solely because their commute is long and they live in a shared flat? Suppose for the sake of this question that the employer would definitely renew the contract if the employee acceded to the demand that they move closer and live alone, and the employer's demand is not related to the nature of the work (e.g. the employee is not required to get to the office quickly in case of emergency, and they do not take home sensitive information which would need to be kept from others in their household). If it would change the answer, assume that these demands would not be written into a renewal contract, rather they only form the basis of whether the employer chooses to offer a renewal.
The original question regards a German employer, and probably in the public sector, but information about other jurisdictions may be interesting too.