Your understanding of why the question is (generally) asked is correct. However, it would be naive in the extreme to think that no employer ever used that question to screen people out, and how would they prove it?
Unless you are in need of an accommodation in order to do the job, you should be saying No to that question.

