From Quake Wiki
In Quake, a special kind of frag (or kill) may occur when a player or monster entity teleports while its teleport destination is being occupied by another creature or player. Depending on several circumstances, such a collision usually results in a very messy death for one or both its participants.
Normally, For player-player and monster-monster telefrags, the initial occupant of the destination spot is killed. On the other hand, monsters are explicitly forbidden to telefrag the player and will explode themselves instead. Players with some knowledge of teleport setups in a map can exploit this technique; an example would be the final room of e1m3.
The Pentagram of Protection artifact also protects its wearer from telefrags and kills any offenders. However, there is no special handling for the case when the teleporting player also has the pentagram, resulting in players being stuck together and unable to move. This had been fixed in QuakeWorld to result in a mutual telefrag.
Sometimes, some telefragging may occur during "multiple monsters teleporting in" ambushes (e.g. because of triggers firing too early or improperly constructed trigger relays). This can be seen in some stock maps, a quite graphic example is the blue key room on e4m8.
Telefrag is the only way to dispatch the final boss of the original Quake: Shub-Niggurath.
Telefragging is implemented via the QuakeC, in triggers.qc. Each teleporting entity makes a call for spawn_tdeath upon successful teleporting. This spawns a special trigger which exists for 0.2 seconds and then removes itself. While it is active, any entity that happens to touch it (except for its owner, which is set to the teleporting entity) wil be damaged for a hefty 50000 (T_Damage (other, self, self, 50000)), thus resulting in a gib death (and an appropriate obituary message for the telefragged player) for pretty much anyone in the game except Shub-Niggurath.