Original: The Onions play a vital role in Pikmin reproduction: When any food, such as prey or pellets, is delivered to an Onion, it propagates seeds, which grow and are then plucked from the ground as fully-developed Pikmin. An Onion also serves as an incubator for all Pikmin of its color, housing potentially hundreds of Pikmin.
Simplified: Olimar gets Pikmin by bringing pellets, a type of food, and bad guys to an Onion, which is the Pikmin's ship.