They help prevent the LED from being damaged. As a diode, the LED has low resistance to the current from the forward direction. If the current comes from the reverse direction, its resistance will turn high. The power source can light up the LED, but it can also destroy it. So you will need resistors to limit the current to a certain value to protect the LED. Especially when there are lots of LEDs in the circuit, using the resistor is the cheapest way to control the current for each LED.
More reading: LED Light Manufacturing: Its Components, Design and Processing Steps