When you're starting the match, and every time you go to a Command Point, and presumably when you die, you choose a class.
Afaik you can not change your class on respawn, because you can't while you're incapped and when you respawn after that, you do it instantly.
But you always respawn next to a CP.
Also, as a sidenote: You always spawn as a Soldier in the beginning, if this has not been changed.
No word on whether you can go Engineer, plant a turret, then switch to Operative to control it. Presumably not, though.
Your turret will be destroyed if you change your class, afaik.