You need a pet that has the ability to learn the talent to start with, or hatch with someone who has a pet with the ability. Not all pets have the ability in first generation.
You need to either get a first gen pet that has the ability in its talent pool, then train it up and see if you get it.. You may have to do that option a bunch..
OR
You can grab an adult pet and hatch with another pet that has the talent and hope the new egg will have it at some point.. you might need to hatch a few times to get it..
I have one pet that has 4 may cast heals, bats, sprite, fairy and unicorn... I kind of wish she didnt have the healing bats.. that one is kind of a sad heal..