What are cannons for on the world map?

Solution 1:

The cannons function much as the 'Warp Zones' of Mario yore. They allow you to skip a few of the world, generally jumping 4 ahead -- World 1 cannon takes you to Jungle World 5, for instance.

As to unlocking them, you must find the alternate exit (you can tell from the red ending flag) within one of the levels that make up the world, usually the level closest to the cannon itself. If you edit your question to specify which world you're interested in, I can drudge up some more details.