He could do that because he used the move Baton Pass on Smeargle. Baton Pass allows you to switch normally, but it has an additional effect of passing stat changes to Pokemon. Ordinary switching never does this, you always lose stat changes by switching normally.
Baton Pass is a very well known move that you need to know about when you do competitive battling. Many Pokemon, including Ninjask, Smeargle, Scolipede and more use Baton Pass sets to pass game breaking boosts to other Pokemon, and some of them depend on the move to even be used at all, which shows how devastating the move is when used correctly.
By the way, a team of three Smeargle's with Minimise is not very good. It's very simple to counter and very predictable, so players prepare for it. If you want to use Baton Pass, use Scolipede or Ninjask, who get Speed Boost which is amazing combined with Baton Pass.