Today when we manufacture or make yoghurt or other soured milk products we use starter cultures to start the process. But these foods have been around for ages, so how did they get the process going? I can't imagine that they walked to some "dealer" and bought powdered starter cultures.
Suitable microbial life for fermentation is present as aerosol in the environment. Open to fresh air, yoghurt (along with beer and similar products) will be inoculated and fermentation will begin.
Alternatively, a portion of the previous product can be used to start the fermentation process by keeping live microbes cool until they are added to the new substrate.
Depending on the product in question, saved live culture or fresh culture from the environment can be used. For example in bread, yeast is kept alive and used from batch to batch. In Lambic beer, the wort is exposed to fresh air in a cool trough to gain new microbes.
Source: Development and Manufacture of Yogurt and Other Functional Dairy Products, Fatih Yildiz, CRC Press, 24 Nov 2009