Hello, I'm Jason. I will do my best to answer your question quickly and accurately using the information you have provided.
The ESP system is essentially traction and yaw control.
It can control braking, acceleration and throttle position
If the ESP senses that the car is not going in your intended direction (it gets information from steering angle, brake pressure, throttle angle, longitudinal and lateral acceleration sensors), then it will apply one or more brake calipers, and modulate throttle position in order to try to straighten the car out
There are many reasons why the light may be on. Typically it's a sensor of some sort. Wheel speed sensor, acceleration sensor, steering angle sensor, but unfortunately, I'm unable to guess. A mercedes-specific scan tool will be necessary to communicate with the system to determine which component has failed