When these cars start to sag on the rear usually it means a failure of one of the following things......
1. air springs
2. level sensor wiring
3. level sensor
4. air lines
5. air pump
6. the air suspension ECU
I've tried to list them in the order in which they are most common.
It's easy to check for air leaks as this is just a case of letting the engine run for 30 seconds or so, switching it off and listening at the rear for hissing. Airbags are the most common problem as they tend to split on higher mileage cars.
The wiring to the level sensors on the rear are a little trickier to get to but still accessible. From experience the wiring tends to chaff through quite close to the sensor connector.
ECU problems are fairly uncommon but not unknown, but check the function of everything else before taking this path.
If you had access to BMW testing equipment there is a test module to set the rear ride height which would be worth trying first. The test module asks you to measure the actually ride height, it then compares this to the sensor value and recalibrates the rear ride height to the specified ride height.
The components of the suspension setup can be seen in the diagram below......