There is no definitive proof or evidence that garlic does anything. It does tend to make the fish more responsive to the food which in turn makes them healthier and stronger to fight off the parasite. It is believed that it strengthens the immune system much like it has been shown to in humans, but I've never read any proof in humans, fish, dogs, cats, etc.....
I'm adding it to my food at the moment since I've got an ich outbreak right now, but I normally don't. The fish are looking better at the moment, but that doesn't really mean anything.