 As told in "The Silmarillion", Ents were created in the Elder Days.They were created to be the "Shepherds of the Trees" and protect trees from the anticipated destruction that Dwarves would cause.Further details are provided in "The Lord of the Rings", where Treebeard recounts to Merry and Pippin how the Ents were "awakened" and taught to speak by the Elves of that time.