Friendly fire is a euphemism originally coined in the military to describe incidents in which friendly units engaged one another as enemies. The term gave rise to the military adage, "There's nothing friendly about friendly fire".
In most team-based shooters, friendly fire is generally penalized in addition to the natural penalty of having weakened one's team. Different games use different systems to punish friendly fire. Some games count the friendly shots as negative kills against a players total kill score, while others use a more elaborate system of punishment. The game with perhaps the most unique method of punishment for friendly fire might have to be America's Army, which kicked the offending player off the server and loaded up a 1:1 scale model of Fort Leavenworth military prison from which the player could not escape without exiting the game.
The game Kane and Lynch twisted the mechanic by allowing players that began on the same team to betray one another in order to improve their overall score. In this instance, the line between friendly fire and hostile fire disappeared completely.
Besides shooters, friendly fire is a common concept in strategy games, especially Real Time Strategy games. Weapons such as arrows, if fired into a mass of enemy and friendly units, will, in many games, kill indiscriminately. Similarly, weapons that do splash damage such as fire pots, artillery shells, nuclear explosions, or massive area of effect spells, will often hurt all units near their point of impact.
Friendly fire has recently popped up in non-traditional game genres. The Platform-Fighting franchise Super Smash Bros. has always featured the option of turning on friendly fire in Team battles. In both PvP and PvE World of Warcraft, friendlies will occasionally be Mind-Controlled for a short duration during which teammates must choose how best to deal with them.