Garlic and onion should not be introduced before six months of age. Recommended to give garlic after seven months of age and onion after eight months of age.
It is important to note that these aren't the perfect food you want to start your baby's journey into the world of solid food. You should only introduce them to your baby's diet after they have successfully eating vegetable and fruits for some time. They generally do not cause allergic reactions in babies, but they can sometimes make your baby gassy.
For more information, it can be found here:
http://canigivemybaby.com/onions/
http://canigivemybaby.com/garlic/