When you attempt to teleport to a square containing a monster, you exchange places with it rather than having the teleport fail and send you somewhere random. This possibly fails based on a monster magic resistance check.