This is a timely question. A person might be afraid to ask their lender, for fear they might jeopardize their ability to get approved for a home loan. So, I will answer here, publicly, for all.
No, a loan officer may NOT inquire about your health. It is illegal to ask if you have an illness.
Similarly, it is illegal to ask if you are pregnant or plan to get pregnant in the future.
However, if your W-2 income has recently changed, then that might be an issue. Does your income still qualify for the loan at the new, lower rate of pay? If so, then you should have no problem with debt-to-income ratio approval.
If you lose your employment and income, then your approval can and probably will turn into a denial. Even if previously approved. Even if it’s 10 minutes before the loan is to close. The lender has the right to deny the loan at any time if it looks like you cannot make the payment.
If you are a 1099 employee or self-employed, then declining income is a significant issue. Lenders are very concerned right now with ability to pay if your business has taken a hit due to the economy. For approval, “worse case” is used when calculating income for approval. This would be something to address with your loan officer right up front so you don’t waste anyone’s time.
I hope this helps explain that an illness does not directly affect your ability to get a mortgage. Only if your income changes does it become a concern to the lender in order to verify Ability to Pay.