The Tree of Harmony is a magical crystal-like tree which holds the Elements of Harmony. It is located in the Everfree Forest, near Princess Celestia and Princess Luna's old castle. The center of the tree has a star shaped like Twilight Sparkle's cutie mark, while Celestia and Luna's cutie marks are on the trunk. It was destroyed by King Sombra in The Beginning of the End - Part 1, but then reformed into the "Treehouse of Harmony" in Uprooted.
Story
Season 4
In the second part of season four's two-part premiere, Twilight Sparkle experiences a flashback where she learns that Princess Celestia and Princess Luna discovered the Tree of Harmony thousands of years ago. The princesses took the Elements of Harmony from the tree and used their magic to defeat Discord.
According to Celestia, the tree controls and contains all that grows in the Everfree Forest, even without the Elements in it.
Twilight Sparkle and her friends discover that the Tree of Harmony has lost its magic, allowing Discord's plunderseeds to sprout and grow all over the Everfree Forest, slowly killing the tree. Twilight and her friends give up the Elements of Harmony and return them to the tree, recharging its magic and restoring the forest.
When the Tree of Harmony regains its magic, a flower sprouts at its roots. The flower blooms to reveal a chest with six locks. Princess Celestia tells Twilight that she doesn't know where the keys are. Celestia assures Twilight that it is a mystery she will not be solving alone.
The tree is seen again with the Elements of Harmony still on its branches with the mysterious chest in front of it. At the episode's climax, the tree activates the elements and connects them with the rainbow power that came from the chest. The tree then transports the chest into the ground in Ponyville, which sprouts into Twilight's new castle. The new castle partly resembles the tree itself.
Season 7
In Shadow Play, it is revealed that the Tree of Harmony first grew from a seed planted by the Pillars of Old Equestria and imbued with the elements within them so that it would protect Equestria from darkness in their absence. After returning from limbo, Star Swirl the Bearded removes the Elements of Harmony from the Tree in order to banish the Pony of Shadows.
Season 8
In The Mean 6, Queen Chrysalis creates artificial clones of the Mane Six in an attempt to seize control of the Elements of Harmony. However, the Tree of Harmony recognizes the clones as fake and destroys them to protect itself.
In What Lies Beneath, the Tree and its abilities have grown to the point of being able to project a physical form of its consciousness (modeled after Twilight Sparkle), and it tests the friendships between the Young Six. Its roots are also shown to have grown under the School of Friendship.
In School Raze - Part 2, the Tree of Harmony's magic prevents Starlight, the Young Six, and the magic of Equestria from being sucked through Cozy Glow's vortex, allowing the Young Six to break free of their imprisonment and defeat Cozy.
Season 9
In The Beginning of the End - Part 1, the Tree of Harmony is destroyed by King Sombra, and the Elements of Harmony shatter along with it.
In Uprooted, the Young Six are called by the Tree of Harmony in their dreams to aid it, and witness its remains. After some arguing over how to best memorialize it, they use the Tree's broken pieces to build a small treehouse, and the Tree's magic transforms it into a grand treehouse at the center of the Castle of the Two Sisters' ruins.
In She's All Yak, Yona travels to the Treehouse of Harmony to be alone after accidentally wrecking the Amity Ball, until Sandbar comes to cheer her up. Sandbar claims that he too would've hidden in the Treehouse if he did the same thing.
In Student Counsel, after Silverstream goes missing, Starlight Glimmer and her friends find her in the Treehouse of Harmony studying cockatrices for a school project.