What do you think abilities are? I have a grumpig whose signature move is Skill Swap and his ability is Thick Fat. So when he swaps his ability, does that mean he loses his body fat and the other pokemon gets overweight? What if the other pokemon had flame body, does Grumpig suddenly burst into flames (let’s say the other was rapidash; it’s just a plain unicorn now)? What about steel types? They suddenly get biological fat on top of their alloy? Why can they only have one ability?
Well… abilities cover such a wide range of concepts that it’s sort of difficult to talk about them as a group – what can you possibly say about a category that encompasses physical traits like Thick Fat and Flame Body, psychological traits like Oblivious and Rivalry, skills like Technician and Sniper, magical properties like Levitate and Wonder Guard, and whatever the hell Mold Breaker is? Looking at stuff that interacts with abilities, like Skill Swap, might be more productive than trying to deal with abilities themselves, but let’s see…
What does stuff with abilities? Trace and Role Play can copy them. Mold Breaker (along with Reshiram’s Turboblaze and Zekrom’s Teravolt) can ignore them. Entrainment, Mummy, Simple Beam and Worry Seed can overwrite them. Gastro Acid can suppress them. Finally, as you mentioned, Skill Swap can exchange them. The pattern seems to be that most of the stuff which affects abilities is mental in nature, influencing thoughts and minds – which is very odd, considering that most abilities represent physical traits. Role Play and Skill Swap are Psychic attacks and seem to be learned mainly by Pokémon who have some degree of psychic power. Worry Seed disrupts abilities by interfering with a Pokémon’s mental state, and Entrainment, the name seems to imply, works by forcing the target to imitate some aspect of the user’s behaviour. What exactly Trace does is vague, but the only Pokémon who get it are Psychic-types (Gardevoir and Mega Alakazam) and Porygon, who is literally made of information, and Porygon’s other ability, Download, to go by the name, seems to work by extracting information from another Pokémon that can be used to overwhelm its defences. Simple Beam, like Worry Seed, overwrites an ability by imposing a particular mental state on its target. Mold Breaker and its ilk don’t actually change anyone’s ability, they just allow abilities to be ignored, and are generally relevant in fairly specific cases; the point of them seems to be that the Pokémon who possess them are just so powerful and destructive that they can override a number of effects that would get in the way of others. How Mummy is supposed to work, frankly, is anyone’s guess; I’ve heard it suggested that Mummy is meant to imitate the spread of a ‘zombie plague’ or similar supernatural disease.
Another point which I think is probably important is that changes to abilities are almost always temporary. Only two things, to my knowledge, can change a Pokémon’s ability permanently: evolution and the Ability Capsule item, and an Ability Capsule can only change it to something else that would have been possible ‘naturally’ in that species. All the other effects will ‘wear off’ in fairly short order.
I think that what happens when a Pokémon’s ability is changed is actually a sort of mind-over-matter effect – a Pokémon with Battle Armour is made to believe so strongly in its own vulnerability that it feels more pain from attacks than should be physically possible; a Pokémon with Levitate loses all faith in its ability to stay airborne; a Pokémon with Flame Body becomes forgetful of its own ability to radiate heat on demand; that sort of thing. Skill Swap, Role Play and Trace are psychic effects of such potency that they can actually pluck a Pokémon’s understanding of and confidence in its own powers from one mind and transfer it to another, instilling a belief that is strong enough to make it so – for a little while, anyway. There’s no physical change in their bodies or powers; it’s all in their own minds, and so the effect vanishes on its own once their own natural mental patterns reassert themselves. If that seems bizarre – well, remember that this is pretty much how Metronome is supposed to work; the rhythmic sound and movement somehow ‘hypnotise’ the user’s brain and body into doing things that should be physically impossible, like Togepi firing off a Wing Attack, Coil, Ingrain, Explosion, Poison Tail, or Roar of Time.
As for Gastro Acid… well, even I can’t explain everything. If you want it to fit with how I’m explaining all the others, I suppose the acid could be a psychoactive compound – that is, Gastro Acid could actually be… well, acid.