From the Super Mario Wiki
The Warp Zone is a hidden area that acts as a kind of teleportation system, connecting many worlds to one place.
In Super Mario Bros., the zone is a sectioned-off area containing pipes to different levels. There are three, one located in World 1-2 and two in World 4-2. The first gives the choice to lead at World 2, World 3 and World 4 and is located over the pipe that leads to the Flagpole. In World 4-2, reaching the part behind the final Pipe leads to World 5 only. Instead, the player must find a secret Beanstalk and reach the overworld in order to choice to lead at World 6, World 7 and World 8. The first Warp Zone hold the infamous Minus World glitch.
In Super Mario Bros.: The Lost Levels, Warp Zones function identically to those in Super Mario Bros. They no longer, however, give the player a choice of destination, as every zone contains only one pipe. Some Warp Zones send the player to an earlier World; for instance, the Warp Zone in World 3-1 leads to World 1. The World 1 warp zone has a gap so Mario can die instead of entering the pipe, but this gap does not exist in the World 5 warp zone accessed from World 8-1. This time, to prevent glitching by jumping over the flagpole, some Warp Zones are located over there.
In The Super Mario Bros. Super Show!, King Koopa would sometimes make his getaway at the end of an episode by throwing a Magic Potion and creating a Warp Zone (usually a door or a portal), which he would escape through.
Characters in Captain N: The Game Master frequently used Warp Zones for means of rapid transit, with the Warp Zones of Super Mario Bros. even being referenced to in the show's first episode.
In Super Mario Bros. 3, World 9 is an island that may only be accessed via Warp Whistle. It is the Warp Zone that connects to the other kingdoms of the Mushroom World, although it was not completely interconnected to access the top row, one had to warp from World 1, accessing the middle row was possible by warping from Worlds 2-4, and the last world from later on. Super Mario Advance 4: Super Mario Bros. 3 referred to the Warp Zone as World 9 Warp Zone.
In New Super Mario Bros., secret exits in levels 1-, 2-A, 3-, 4-, and 5- lead to Warp Cannons which launch Mario or Luigi to a later world (the first two to World 5, then 6, 7, and 8, respectively). Advancing to a new world regularly was probably replaced by the World Map.
In New Super Mario Bros. Wii, Warp Zones appears exactly like in New Super Mario Bros., but they can be unlocked via secret exit in the following levels: 1-3 and 2-6 leads to World 5, 3- and 4- to World 6, 5- to World 8.
In New Super Mario Bros. 2, the Warp Zones changes they appearance, but are still unlocked via secret exit. When a player enters in these level, they will find a Cannon and will be sended in a Space-like course. They must jump perfectly in order to reach the end of the level and gain access to a secret World. The levels where they are unlocked are the following: 1- to World Mushroom, World 3- or World Mushroom-B to World Flower and World Flower-A to World 6.
In New Super Mario Bros. U and New Super Luigi U there is a similar mechanic but Warp Zones don't appear at all. Some secret exits unlocks a longer path than normal that leads to a special level. These special levels are the following (the first link of a pair indicates NSMBU level, the second link the NSLU level): Blooper's Secret Lair/Cheep Chomp Chase (in Acorn Plains) and Piranha Plants on Ice/Slippery Rope Ladders (in Layer-Cake Desert) leads to Soda Jungle, Skyward Stalk/Beanstalk Jungle (in Sparkling Waters) and Fliprus Lake/Fliprus Floes (in Frosted Glacier) leads to Rock-Candy Mines, Flight of the Para-Beetles/Para-Beetle Parade (in Soda Jungle) leads to Meringue Clouds.
The Warp Zone also appears in the games Super Mario 3D Land and Super Mario 3D World. They are in the same places as they were in the original Super Mario Bros., in World 1-2 and World 4-2. However, there is only one orange pipe, and they only warp the player to the next world.