My grandmother was born in the late 1800s and she insisted that when we walked to the store I walk on the curb side and I'd have to switch sides if we crossed a street. I finally asked her why and she said if a horse jumps the curb you'd get killed first.
That was still the custom when I was in college, and probably later. My understanding of it was that historically, it was to protect the ladies from the slops being thrown out of upper windows. But by my time, I think it was just in case a car hit a puddle. It was mostly just a habit.