To ward off something is to keep it from happening. You might try to ward off the virus that's going around by washing your hands constantly.
When you ward something off, you keep it at bay or prevent its occurrence. You might ward off your grandmother's kisses by holding a tray of cookies in front of yourself when she arrives, or swear that you ward off the flu by eating plenty of oranges and grapefruit. In the late 16th century, the verb ward was used to mean "parry" or "fend off," with the off being added much later.