Block prevents the target from switching out or fleeing (including via Teleport). The effect only applies as long as the Pokémon that used it remains in battle.
The affected Pokémon can still switch out via Baton Pass, and the Pokémon that switches in will no longer be affected. Affected Pokémon can also switch out with U-Turn and Volt Switch. Conversely, the Pokémon that used Block can switch out with Baton Pass and the effects of Block will still apply. Also, if the affected Pokémon is Roared at or hit with a Whirlwind, or has Dragon Tail or Circle Throw used on them, they will still be switched out.
If a wild Pokémon uses Block on the player's Pokémon, the player will be unable to escape, unless the player's Pokémon has Run Away or is holding a Smoke Ball.