From the Super Mario Wiki
Apples are fruit that appear in many Mario games. They have had many different uses throughout its many appearances.
Mario's Time Machine
The apple that caused Isaac Newton to first speculate on the concept of gravity is one of the historical objects stolen by Bowser in Mario's Time Machine. Mario rescues the apple from Bowser's Museum and manages to return it to 1687 so that it can properly fall for Newton.
Apples have a rather large role in Yoshi Topsy-Turvy, where Bowser turns all of the Egglings into apples when they fly to Yoshi's Island after the Koopa Troop's attack on their homeland. The Spirit Who Loves Cuteness, a friend of the Egglings, is dumbfounded and enlists Yoshi to seek the apples and eat them, which restores the Egglings to their initial forms. The apples in this game are red and green, and, while the two colors of apple can be found doing anything regardless of any kind of coloration code, green ones typically stay in one spot and most red apples glide downward on parachutes.
Yoshi Touch & Go
Paper Mario series
In Paper Mario, they are a cheap item found only in Boo's Mansion. One is able to find Apples by simply Spin Jumping on various crates in the right room of the first floor of the mansion. They heal five HP, and they are one of the ingredients used to make Apple Pies, the other being Cake Mix.
Super Paper Mario
Super Paper Mario returns apples; however, in the game, there is no such item named "Apple". There is only Red Apple. Also, this game introduces new apples, including the taboo Black Apple, the luscious but cursed Golden Apple, the mustache-inducing Yellow Apple, the fruit-transforming Pink Apple, and the shrinking Blue Apple. All apples in this game simply restore five HP, except for the Black Apple, which restores only one when used on a playable character; the above ailments are induced only when they are given to a non-playable character. The more-useful Primordial Fruit introduced earlier in Super Paper Mario also slightly resembles that game's apples, although the two items' exact relations are unknown.
Mario Party series
Mario Party 2
Mario Party 7
Super Smash Bros. series
Apples also appear in Super Smash Bros. Melee. They occasionally fall from Whispy Woods in the Green Greens stage. They can be thrown at other players to damage them. A smaller variety appears as food; these Apples can heal 5% health. The apples are absent anywhere else in the game, however; they do not even appear as a Trophy.
In Super Smash Bros. Brawl, apples once again appear as food that restore health, as well as a Trophy. Also, if Mr. Game & Watch hits an opponent with his Judge hammer holding a sign saying "7", an apple appears.
Apples from the Animal Crossing series appear in Super Smash Bros. for Nintendo 3DS in the Tortimer Island stage, which serve as recovery items. Additionally, one of the fruits the Assist Trophy Isabelle can throw at players to heal them is an Apple from the same series.
Donkey Kong Jungle Beat
Super Mario Galaxy
In Super Mario Galaxy, three Apple Planets appear in Gusty Garden Galaxy, and its habitants include Flipbugs, Boulders and some Wigglers. For progressing, Mario must Ground Pound the correct wooden pegs on each Apple Planet in order to make a giant green worm burrow through each of the three planets.
Mario Sports Mix
Wario Land series
Paper Mario recipes
Trophy information from Super Smash Bros. Brawl
Super Paper Mario apples