How do infants get their very first gut bacteria?
Well, the former is exclusively the answer. Humans (or other mammals, or any species in general) cannot give birth to new species (of bacteria, here); they have to be acquired from the environment at all costs. However, the environment does vary, leading to variance in gut microbiome, as will be discussed later.
First of all, gut microbiome is only a part of the total microbiome of humans (Sherwood et al, 2013). Now, usually, gut bacteria are acquired by a person within one to two years of birth (Sommer et al, 2013), while the gut of a fetus is considered as sterile. However, microbial colonization in a fetus is possible (Matamoros et al, 2013). For example, species of Lactobacillus and Bifidobacterium were found in biopsies of placenta in one study (Mueller et al, 2017).
During birth and rapidly thereafter, bacteria from the mother and the surrounding environment colonize the infant's gut. Infants born by caesarean section may also be exposed to their mothers' microflora, but the initial exposure is most likely to be from the surrounding environment such as the air, other infants, and the nursing staff, which serve as vectors for transfer. During the first year of life, the composition of the gut flora is generally simple and it changes a great deal with time and is not the same across individuals (Sommer et al, 2013).
Now lets talk about variation in gut microbiome among individuals. The gut microbiome of an individual may vary depend mainly due to:

Age:  the diversity of microbiota composition of fecal samples is significantly higher in adults than in children, although interpersonal differences are higher in children than in adults. Much of the maturation of microbiota into an adult-like configuration happens during the three first years of life.
As the microbiome composition changes, so does the composition of bacterial proteins produced in the gut. In adult microbiomes, a high prevalence of enzymes involved in fermentation, methanogenesis and the metabolism of arginine, glutamate, aspartate and lysine have been found. In contrast, in infant microbiomes the dominant enzymes are involved in cysteine metabolism and fermentation pathways (Yatsunenko et al, 2012).

Diet: Gut microflora is mainly composed of Prevotella, Bacteroides, and Ruminococcus. There is an association between the concentration of each microbial community and diet. Prevotella is related to carbohydrates and simple sugars, while Bacteroides is associated with proteins, amino acids, and saturated fats. Specialist microbes that break down mucin, survive on their host's carbohydrate excretions. One enterotype will dominate depending on the diet. Altering the diet will result in a corresponding change in the numbers of species (Wu et al, 2011).

Geography: In simple terms, gut microbiome composition depends on the geographic origin of populations. For example, the US population has a high representation of enzymes encoding the degradation of glutamine and enzymes involved in vitamin and lipoic acid biosynthesis; whereas Malawi and Amerindian populations have a high representation of enzymes encoding glutamate synthase and they also have an overrepresentation of $\alpha$-amylase in their microbiomes. As the US population has a diet richer in fats than Amerindian or Malawian populations which have a corn-rich diet, the diet is probably a main determinant of gut bacterial composition (Yatsunenko et al, 2012).
Further studies have indicated a large difference in the composition of microbiota between European and rural African children. The fecal bacteria of children from Florence were compared to that of children from the small rural village of Boulpon in Burkina Faso. The diet of a typical child living in this village is largely lacking in fats and animal proteins and rich in polysaccharides and plant proteins. The fecal bacteria of European children was dominated by Firmicutes and showed a marked reduction in biodiversity, while the fecal bacteria of the Boulpon children was dominated by Bacteroidetes. The increased biodiversity and different composition of gut flora in African populations may aid in the digestion of normally indigestible plant polysaccharides and also may result in a reduced incidence of non-infectious colonic diseases (de Filippo et al, 2010).


Also, as @com.prehens.ible says in comments, there are various other modes through which an infant may acquire bacteria to give rise to their gut microbiome. For more information, you can also read the Wikipedia page on Gut Flora.
References:

Sherwood, Linda; Willey, Joanne; Woolverton, Christopher (2013). Prescott's Microbiology (9th ed.). New York: McGraw Hill. pp. 713–721. ISBN 9780073402406. 

Sommer F, Bäckhed F (2013). &quot;The gut microbiota—masters of host development and physiology&quot;. Nat Rev Microbiol. 11 (4): 227–38. PMID 23435359. 

Matamoros S; et al. (2013). &quot;Development of intestinal microbiota in infants and its impact on health.&quot;. Trends Microbiol. 21 (4): 167–73. PMID 23332725. doi:10.1016/j.tim.2012.12.001.

Mueller, Noel T.; Bakacs, Elizabeth; Combellick, Joan; Grigoryan, Zoya; Dominguez-Bello, Maria G. (2017-04-08). &quot;The infant microbiome development: mom matters&quot;. Trends in molecular medicine. 21 (2): 109–117. ISSN 1471-4914. PMC 4464665 . PMID 25578246. doi:10.1016/j.molmed.2014.12.002.

Yatsunenko, T.; Rey, F. E.; Manary, M. J.; Trehan, I.; Dominguez-Bello, M. G.; Contreras, M.; Magris, M.; Hidalgo, G.; Baldassano, R. N.; Anokhin, A. P.; Heath, A. C.; Warner, B.; Reeder, J.; Kuczynski, J.; Caporaso, J. G.; Lozupone, C. A.; Lauber, C.; Clemente, J. C.; Knights, D.; Knight, R.; Gordon, J. I. (2012). &quot;Human gut microbiome viewed across age and geography&quot;. Nature. 486 (7402): 222–227. Bibcode:2012Natur.486..222Y. PMC 3376388 . PMID 22699611. doi:10.1038/nature11053.

Wu, G. D.; Chen, J.; Hoffmann, C.; Bittinger, K.; Chen, Y.-Y.; Keilbaugh, S. A.; Bewtra, M.; Knights, D.; Walters, W. A.; Knight, R.; Sinha, R.; Gilroy, E.; Gupta, K.; Baldassano, R.; Nessel, L.; Li, H.; Bushman, F. D.; Lewis, J. D. (2011). &quot;Linking Long-Term Dietary Patterns with Gut Microbial Enterotypes&quot;. Science. 334 (6052): 105–8. Bibcode:2011Sci...334..105W. PMC 3368382 . PMID 21885731. doi:10.1126/science.1208344.

De Filippo, C.; Cavalieri, D.; Di Paola, M.; Ramazzotti, M.; Poullet, J. B.; Massart, S.; Collini, S.; Pieraccini, G.; Lionetti, P. (2010). &quot;Impact of diet in shaping gut microbiota revealed by a comparative study in children from Europe and rural Africa&quot;. Proc. Natl. Acad. Sci. U.S.A. 107 (33): 14691–14696. Bibcode:2010PNAS..10714691D. PMC 2930426 . PMID 20679230. doi:10.1073/pnas.1005963107.