Gut bacteria are an extremely powerful system within our bodies and are mostly still mysterious to us. Imbalances of one type or another lead to large amounts of bacterial toxins being introduced to the intestine and the bloodstream, with wide-ranging mental and physical effects. I'm not surprised that contribution to obesity is among them.
It works kind of like this:
You eat too much refined/processed food, that is high in sugars of any kind, especially complex polysaccharides and the food is not fully digested by your stomach + small intestine, and ends up in your large intestine. This surplus of sugars provides abundant food to your billions of gut bacteria, and they start to grow out of control, and mutate. Those mutated bacteria now dump their toxic waste by-products into your body.
Following restricted diets that are intended to reduce the food supply to your gut bacteria colonies is a valid and often the only successful way to treat the conditions caused by this influx of bacteria and toxins.
Antibiotics of any kind are simply too broad a weapon - they will attempt to eliminate everything which will result in other imbalances. The food we eat every day is the most important factor for intestinal and therefore overall health...
[1] This book is helpful: http://www.breakingtheviciouscycle.info