Yes, the Battle of Five Armies occurs at the end of
The Hobbit. Chronologically speaking, this battle happens about sixty years before the start of
Lord of the Rings.
Basically, Thorin and Co. have been denying requests by Bard of Lake-town and the elven king Thrainduil to share out some of Smaug's treasure. Tensions escalate, and Thorin prepares to lead the Dwarves into battle, along with his cousin Dain and an army of Dwarves from the Iron Hills, against the Men of Lake-town and the Elves of Mirkwood. Just as it looks like war is about to break out, Gandalf stops everyone and draws attention to the fact that a large army of gobilins is converging on the Lonely Mountain. These goblins are seeking revenge for the death of their king at the hands of Gandalf. Anyway, the three groups join together to fignt against the goblins and are soon reinforced by the giant Eagles of the Misty Mountains. Eventually, Beorn joins the battle. The end result is that the goblins are defeated, but at the cost of Thorin's life. After the battle, Dain takes up leadership of the Dwarves of the Lonely Mountain, and Bard re-establishes the city of Dale near the Mountain.
Ghostavo, I'd highly recommend finding/making time to read
The Hobbit and
The Silmarillion. You won't regret it

.
P.S. I've never thought about this before, but since this battle involved Thrainduil and his people, it's likely that Legolas fought in it.