Do I have to be able to swim?

No, you don’t need to know how to swim. Wear a buoyancy aid or lifejacket and you will be fine. Let your instructor or fellow sailors know if you are a non swimmer.