Obesity is a worldwide epidemic, threatening both industrialized and developing countries, and is accompanied by a dramatic increase in obesity-related disorders, including type 2 diabetes mellitus, hypertension, cardiovascular diseases, and nonalcoholic fatty liver disease. Recent studies have shown that the gut microbial community (microbiota) is an environmental factor that regulates obesity by increasing energy harvest from the diet and by regulating peripheral metabolism. However, there are no data on how obesogenic microbiotas are established and whether this process is determined during infancy. The sterile fetus is born into a microbial world and is immediately colonized by numerous species originating from the surrounding ecosystems, especially the maternal vaginal and fecal microflora. This initial microbiota develops into a complex ecosystem in a predictable fashion determined by internal (eg, oxygen depletion) and external (eg, mode of birth, impact of environment, diet, hospitalization, application of antibiotics) factors. We discuss how the gut microbiota regulates obesity and how environmental factors that affect the establishment of the gut microbiota during infancy may contribute to obesity later in life.