When you drive, you have to share the roadway with a variety of vehicles, bicyclists, and pedestrians. Pedestrians are the most vulnerable of those, so it is your responsibility as a driver to watch out for them and yield the right of way to avoid accidents. The law is very specific on when you have the right of way and when pedestrians have it. You must know the law and follow it to avoid a pedestrian accident.
The California Department of Motor Vehicles explains that anytime a pedestrian is in the roadway, you need to stop and allow him or her time to cross. It does not matter if they are moving slowly or if you have a green light at an intersection. If the pedestrian is already in the roadway, you must yield. The same is true if a pedestrian on the side of the road makes eye contact with you to indicate he or she is ready to cross.
You also need to slow down when approaching crosswalks in preparation to stop should there be someone crossing at the time. Any signage that you see pertaining to pedestrians will often tell you to stop at a certain point or remind you of state laws requiring you to yield to anyway crossing the street. You must obey these signs.
One last note, pedestrians crossing the street at any point, whether marked or not, have the right of way, and you must stop and let them cross. Generally, these legal crossings are at intersections, but in some cases, they may be in the middle of a roadway.