Maybe. Garlic has been used for many medicinal purposes over centuries. One of those has been to fight infection. Although it has been shown to have antibiotic properties in petri dishes in laboratories, evidence that it's an effective way to prevent or treat infections in people is lacking. Nevertheless, people use it and swear by it. Evidence that it may help prevent certain cancers is stronger.