If I have a Pokemon out, and I switch into Dugtrio, would the opponent be able to switch?
On the same turn yes, other than that they will be stuck in. Flying Types and levitates can escape anytime.