As per Ayurveda Onion & Garlic are Tamasik and Rajasik in nature. A peculiar feature of such substances is that they increase agitation, anxiety, inertia, dullness, sleep and ignorance. Due to these properties they are not good for a practitioner of Meditation. A regular consumption of these items will cause you to feel sleepy and dull during meditation.
Onion & Garlic are aphrodisiac. Yoga recommends maintaining celibacy for quick spiritual progress and eating these substances will be contradicting to the basic guidelines of Yoga.
In addition to producing strong odor and taste, they are (especially Garlic) also known to destroy bacteria (good & bad) from the digestive track and too much consumption may have undue effects on digestion.
Of course, eating them once in a while won't cause too much impact but they should be avoided from day to day diet.