We have all had selection interviews where we were asked some questions, which in principle have no obvious relation to the candidates for the job. Some of them can be downright absurd, difficult or uncomfortable. What is said, is that the specific circumstances of the problem is illegal.
In Spain, the law that regulates what may or may not be asked in a selection interview is the so-called
Law on Infractions and Penalties in the social order
and, specifically, its article 16.
Requesting personal data constitutes discrimination in access to employment. Such conduct constitutes a very serious infringement punishable by a fine of at least 6,251 euros.
Nowadays, with the changes caused by the pandemic, and as a consequence of contracting the virus, many companies have considered whether it is possible to ask candidates if they have passed the coronavirus or if they are immune to the disease. A big mistake on their part, since as we have mentioned above, it is not valid to ask this type of personal questions unrelated to the work to be performed.
The medical condition of your candidates is a matter of privacy and is unnecessary for the selection of personnel.
The most professional thing to do is to focus on finding out aspects related to the professional profile: such as work experience, skills, or studies to achieve a better candidate.