All (legitimate) Pokemon retain their ability when transferred to another game. However, some Pokemon species get new abilities between generations. (example: Scizor always have swarm in Generation 3, but it can have swarm or technician in Generation 4) If this happens, the ability only updates when a Pokemon evolves.

2 Answers

0 votes

I'm assuming what you mean is that Pokemon A had sturdy in generation 4 as its only ability and in generation 5 Pokemon A's sturdy was instead replaced with levitate? Then no, there is no instance of that.

There are abilities that did change when transferring from generation 3 to 4 and generation 3 up to 5 when you evolved the traded Pokemon in the new generation. I'm not exactly sure this is what sumwun meant to say, but based on your Pokemon's PID, your Pokemon's ability could change in the transfer from generation 3 to 4. More info on that can be found here. If you transfer a Pokemon all the way from generation 3 to 6 and then evolve it, it will keep its ability slot.

Edit: There were unreleased Hidden Abilities in generation 5, and some of them were changed and distributed upon the release of Generation 6.

(And yes, you can always hack and change it manually.)
Just ask if you have any more questions. :)