This is also the same for regular abilities. See it this way: Pokemons have 3 possible ability slots: Ability 1, Ability 2 and Hidden ability. When you catch a pokemon, it will have one of the slots, and even if it evolves, it will remain in that slot.
For example, Tyrogue has Guts in his Ability 1 and Steadfast in its Ability 2. His evolution, Hitmontop, has Intimidate in his Ability 1 and Technician in his Ability 2. If you want an Hitmontop with Technician, you would need to catch a Tyrogue that has Ability 2, or Steadfast.
There's certain cases where a same ability is in multiple slots, however. In general, that's going to happen for the last evolution of a pokemon, but looking at a list of pokemon per ability, there's Spewpa who has both normal abilities as Shed Skin, but evolves in Vivillon who has two normal abilities. So if you catch a Spewpa, you can't tell which ability it will have upon evolving, as you don't know if it has an Ability 1 Shed Skin or an Ability 2 Shed Skin.