Modern chains have inner and outer links. On a conventional chainring, all of the teeth are the same width, and therefore have to be narrow enough to fit into the chain’s inner links. This means that there’s enough space for the chain to move about a bit from side to side on the chainring, which can cause it to fall off.
Historically this hasn’t been much of a problem, since on geared bikes the front derailleur cage tends to stop it from falling off, and on single-speed bikes there’s no chain slack or gear changing at the rear to cause chain-drop.
However, when you remove the front derailleur, but keep the rear derailleur (as is becoming common with single-ring setups), dropping the chain becomes more of a problem. This can happen when changing gear on the cassette, or when a bump causes the chain to go slack momentarily.
Narrow-wide chainrings have alternating narrow and wide teeth that fit into the inner and outer links respectively. This makes the chain more secure on the chainring and less likely to fall off.
A narrow-wide ring is only necessary if you have a single chainring at the front and a rear derailleur. They won’t work at all if you have more than one chainring at the front, since you won’t be able to change gear. You don’t need a special cassette, but you might benefit from using a clutched rear derailleur (particularly on a MTB), which prevents the chain from going slack on bumpy terrain.
A well-established alternative to a narrow-wide ring is a chain guide, which behaves somewhat like a front derailleur in keeping the chain from falling off: