Uh. Sidewalks existed and pedestrians mostly stayed on them for their own safety. Jaywalking wasn't made illegal until the 1950s, well into the car era.
And it wasn't just horses. It was horse-drawn carriages. There wasn't that much difference, traffic wise, between carriages and cars. There were traffic jams, out of control vehicles, drunk drivers, street racers, collisions, etc. all back in the 19th century.