There are two main ways to get Pokémon on the main Pokémon games: either catching it through random encounters or breeding them. Breeding has been available since the second generation, more specifically due to the Day-Care Couple. By leaving to Pokémon of the same type and opposite genders, an egg will eventually appear. Pokémon without sex can also be left at the daycare and will produce eggs if left with a Ditto.
Legendary Pokémon cannot breed.
Each Pokémon belongs to one or more Breeding Groups and they are compatible with any Pokémon in the said group. The offspring of the relation will always be the Female Pokémon, although it can inherit moves from the father.