From the Super Mario Wiki
Fortresses, or Forts are fortified buildings that appear in many Mario games, starting with Super Mario Bros.. Usually, Fortresses are found at the end of levels. After reaching the Fortress, Mario or Luigi can advance to the next level. However, some fortresses, like the ones from Super Mario Bros. 3 and Super Mario World are made like castles.
In Super Mario Bros. 3, the fortresses that advance Mario to the next level do not appear. Instead, Fortresses are usually found in the middle of worlds. They are levels with Boom Boom as their only boss, and he must be defeated to gain access to other parts of the world.
The End-of-Level Fortresses later return in New Super Mario Bros., New Super Mario Bros. Wii, New Super Mario Bros. 2, and New Super Mario Bros. U and reprise their earlier role from the first Super Mario Bros. game, allowing Mario or Luigi to continue to the next level. Black fortresses appear when the player finds a secret exit.
The Towers in New Super Mario Bros. Wii are indirectly called Fortresses.
Appearances in Other Media
In the Mario Ice Capades, during the whole show, King Koopa rode a moving fortress. A fortress also appeared in the background of the show as a prop. In The Super Mario Bros. Super Show!, a fortress appears only in the intro.