Okay so this just happened to me minutes ago,my mom was in the middle of a turn when a police car was coming head on, there was no indication or anything he was just driving like normal but before he got to the stop. Just about a little less than halfway he flipped on lights and his sirens no warning what do ever we had to slam on our brakes to avoid hitting him or vis versa. I was wondering if he could do something like that, I live in California and it happened in Modesto. I personally don't think he should've done that and that it was probably illegal for him to do so, it could've caused an accident.
A police officer (or other emergency service driver) will turn their lights and siren on as soon as they have a need to do so. This may be in response to something they've seen or in response to an emergency call. Since you can't see and hear what they can see and hear this may seem sudden or arbitrary to you.
Your obligations, as spelled out in the 2019 California Drivers Handbook (p. 74) are:
You must yield the right-of-way to any police vehicle, fire engine, ambulance, or other emergency vehicle using a siren and red lights. Drive to the right edge of the road and stop until the emergency vehicle(s) have passed. However, never stop in an intersection. If you are in an intersection when you see an emergency vehicle, continue through the intersection and then, drive to the right as soon as it is safe and stop. ...
You have to get out of their way.
However, they are still obliged to drive safely subject to the circumstances (e.g. that they are on the wrong side of the road traveling fast) and, in the event of a collision, you may not necessarily be at fault.