From the Super Mario Wiki
A flashing Shell (also described as a flashing kamikaze Koopa shell, flashing Koopa shell, or flashing Koopa Troopa shell) is a type of Koopa Shell found only in Super Mario World and its GBA remake, Super Mario World: Super Mario Advance 2. It is created when a yellow Koopa without a Shell climbs into an empty one of any color, including its own, after being ejected from it, thus creating a flashing Shell. After its transformation, the Shell attempts to hit Mario or Luigi by spinning around and dashing towards them. It becomes impossible to separate the Koopa from it.
Jumping on a Shell causes the Mario Bros. to bounce upwards, but it does not damage it. They can only be defeated with a Yoshi, a Spin Jump, or a Super Star. If any Yoshi eats one, it obtains all three shell abilities (causing sand clouds, flying, and breathing fire), as long as the Shell stays in the Yoshi's mouth.