After the phrase “take an exam,” the infinitive form (“to + verb”) is used to express purpose or necessity.
So: You have to take an exam to pass the course.
The other options are incorrect because:
passing → would change the meaning (e.g., “an exam passing the course” doesn’t work).
have pass → ungrammatical (missing “to” before “pass”).
for pass → “for” requires a noun/gerund (“for passing”), but here purpose is better expressed by the infinitive.