The story behind the Valley was that the two founders of Konoha, Hashirama Senju (the First Hokage and Head of the Senju clan) and Madara Uchiha (The Head of the Uchiha clan) had a battle there as a result of Madara feeling betrayed and wanting revenge against Hashirama. It is also there that the Nine-Tailed Demon Fox makes its first known appearance, under the control of Madara. As explained by Sasuke, the battle was so great, that the two tore the earth itself apart and created the valley.
Hashirama managed to defeat Madara, and in memory of their duel, two giant statues were built on opposite sides of the waterfall. Madara on the left (Land of Sound side, formerly the Land of Rice Fields) and Hashirama on the right (the Fire Country's side of the border) (see picture on the right)
The Second Battle at the Valley of the End
Many years later, a descendant of Madara, and the son of the Minato Namikaze fought, Sasuke Uchiha and Naruto Uzumaki respectively. As with the fight between the First and Madara, Sasuke, aided by Orochimaru's Sound Four, made his way to the Valley of the End with Naruto in pursuit. As the two fought, both awakened great yet dangerous powers; Naruto slipped into his one-tailed transformation, and Sasuke activated the second level of his Cursed Seal of Heaven. In the end, the two attacked each other with enhanced versions of their signature techniques, the Demon Fox Rasengan, and the Flapping Chidori, with the two attacks colliding and forming a dome around Naruto and Sasuke. Naruto scratched Sasuke's forehead protector while Sasuke struck Naruto in the chest. When the battle settled, Naruto was unconscious and Sasuke was coughing up blood, Sasuke left to seek out Orochimaru.
Ironically, before the battle started, Sasuke stood atop Madara's head, while Naruto stood atop the First's, symbolizing the similarities between the two and their respective predecessors. Both Madara and Sasuke betrayed Konoha, while Naruto and the First Hokage, affiliated to Konoha, attempted to stop the formers.
However, unlike the original battle in which the First Hokage successfully defeated Madara, Sasuke emerged victorious from his battle with Naruto.
Also, like in the first battle, the demon fox played a role in it, this time sealed within (and providing chakra to) Naruto.
The Return of Madara Uchiha
Three years later, after the death of Deidara, Madara Uchiha, in the guise of Tobi, returned to the valley and sat upon the head of his statue. While there, he was amused on the growth of Sasuke's power, and his destiny.