Monsters are usually not permitted to teleport to a space that is occupied, preventing them from telefragging. The only situation in which they are permitted to telefrag a player is when they try to teleport in MAP30 of any Doom II-based WAD, because it is needed by the spawn shooter cubes to spawn a new monster, so it will not get stuck inside any other thing (some source ports allow the player to remove this exception or apply it to all maps). This is also applicable when the map is played on Nightmare difficulty or with the -respawn parameter set. A player who is invulnerable or using the God mode cheat will not be protected from telefrags. A barrel that is placed on a teleporter destination can be telefragged and will explode as if it were shot, with the incoming player teleporting into the center of the explosion.
Invulnerability or "invincibility" only protects a player from attacks doing less than 1000 points of damage, whereas a telefrag inflicts 10000 points (see the function P_DamageMobj in p_inter.c). The Doom source code refers to a telefrag as a "stomp".