Thorin Oakenshield, Bard of Lake-town, and the Elven-king were locked in an impasse. Bard and the Elven-king had formed an alliance in an attempt to persuade Thorin to repay the people of Lake-town for all the damages that Smaug caused the night the dragon left the Lonely Mountain and destroyed most of the town. Thorin staunchly refuses to give any of the treasure away, and even with Bilbo's giving Bard the Arkenstone as a bargaining chip, the dwarves still will not come to a reasonable agreement.
The tension escalates as Dain Ironfoot, Thorin's cousin, arrives and sees the camp of men and elves entrenched at the foot of the mountain. Both sides are ready to attack--and then Gandalf cries out "Dread has come upon you all!" (251) The Goblins and Wargs arrive, swiftly changing the outcome of Bard's siege.
The Battle of the Five Armies had the positive side-effect of making the elves, men, and dwarves join forces to defeat the Goblins and Wargs. At the end of the battle, the goblins' numbers are greatly diminished, and the dwarves, under Dain's leadership after Thorin's passing, do make amends with Bard and the Elven-king, thus resolving the original conflict.
THe Goblins entering the battle affects the warring parties by making them band together to fight against the Goblins. They all team up to fight the Goblins beacause the Goblins are every ones enemy.