From the Super Mario Wiki
Watermelons are fruit that appear in several games of the Mario series and differ from game to game. They're based on the real-life fruits and strongly vary in size. Watermelons appear mainly in Yoshi series, along with many other kinds of fruits.
 Yoshi series
In Super Mario World 2: Yoshi's Island and Yoshi's Island: Super Mario Advance 3, there are three different types that offer special attacks. Super Green Watermelons allow a Yoshi to spit out the seeds as projectiles; if it already has a bite mark in it, there will only be a third as many seeds. Super Red Watermelons allow three shots of fire breath that burn enemies and melt Ice Blocks. Special Blue Watermelons allow three shots of ice breath that freeze enemies, making them harmless and immobile and causing them to break apart when a Yoshi touches them.
In Yoshi Touch & Go, Watermelons, when eaten, give Yoshi five eggs.
 Super Mario series
 Super Mario Sunshine
In Super Mario Sunshine, massive Watermelons appear. In Gelato Beach, a shack makes Watermelon smoothies, and there is a festival to show off the person with the largest Watermelon. The Watermelons there are extremely sensitive to pressure, and act and look more like water balloons. In the secret levels, Watermelon Blocks can be found, which act as breakable blocks.
 Super Mario Galaxy and Super Mario Galaxy 2
In Super Mario Galaxy and its sequel, when 9999 Star Bits are collected, all the green coconuts in the game turn into Watermelons. In the first game, a Watermelon is featured in the mission entitled "Bubble Blastoff" of the Deep Dark Galaxy. Mario lands on a planet where he must Ground Pound the three encircling tennis balls within the planet which will hit the Watermelon in the center and cause it to grow visibly larger until it shatters the glass planet and becomes the new planet.
 Donkey Kong series
 Mario Party series
 Mario Party 5
In Mario Party 5, green Watermelons similar to those found in Super Mario World 2: Yoshi's Island appear as a battle weapon worth seven battle points.
 Mario Hoops 3-on-3
In Mario Hoops 3-on-3, the Watermelon is one of the unlockable basketballs.
 Mario Sports Mix
Watermelons also make an appearance in the Wii game, Mario Sports Mix. In this game, they are objects that appear in the minigame, Feed Petey. If the player shoots one watermelon into Petey Piranha's mouth, they are awarded fifty points. To obtain the watermelon, the player must jump up under the watermelon. The watermelon is suspended in midair on a rope.