If you don't have depression and never have, then the answer is 'no'.
However, there's no doubt that an honest answer to the question 'Do you have any existing or prior medical condition that may affect your ability to do the job?' will take account of mental health as well as physical health, unless the form explicitly indicates otherwise.
If you do or have had depression, the key question is what effect you expect your depression to have on your job. If you had a week off and were prescribed some mild medication ten years ago and you've had no history since, it's probably safe to assume it's now going to be of no consequence to your job.
On the other hand, if you do think it is liable to recur and recurrence would affect your ability to do your job, then ticking 'no' would be making a false statement to your potential employer, which in most jurisdictions be considered grounds for termination and may have other negative implications (e.g. on any reference they give).
Furthermore if you do later require adjustments in your workplace because of a pre-existing condition, you may have problems justifying it if you did not declare it, or you may be forced to reveal you filled in the form with false information, potentially resulting in disciplinary action or dismissal, which you probably aren't going to want to have to deal with when your mental health is at a low point.
With regard to the concern that the employer may choose not to hire you on the basis of your medical history, it is impossible to know this. Depending on the jurisdiction, this may be illegal, though hard to prove. It's generally a good sign if the part of the form they ask you is a separate sheet which is sent to Occupational Health and not the hiring manager, or if you are asked after being offered a job. Otherwise, it might be evidence of an intention to discriminate. Ideally, the only thing they should need to know before making offers is if there are any adjustments they need to make to the interview process (e.g. level access to the interview room).
Consider also whether you want to work for an employer who does not want to hire people who have depression. That's by no means a solution to discrimination, but it is something that may influence your decision.