The 'Battery Monitor System' (BMS) monitors all current been drawn from the battery and all charge current flowing in to the battery. It knows the state of charge of the battery when it was parked and can easily calculate how much of the capacity has been used and what the present SOC is.
This is why on vehicles equipped with BMS that when charging the car battery you must charge it while the battery is still connected to the car. Also the battery charger positive lead has to be connected to the battery post, but the negative charging lead needs to be connected to the chassis earth point (NOT the battery). This then allows the BMS which is fitted to the negative battery post to monitor the charge and update the known value of the SOC.