Hitchhiking was made illegal in many states over a number of years.
In some states, it was to protect well-meaning citizens from vagrants and bums who might attempt to rob them. It gave police a means by which to check up on "vagrants" and/or other people who obviously had no means to pay for bus or train fare. Originally it was simply a crime to hitchhike along the highway. To discourage drivers, picking them up became an infraction so officers could investigate both parties for criminal activities or wants & warrants.
Hitchhiking is prohibited (in California) as:
21957. No person shall stand in a roadway for the purpose of soliciting a ride from the driver of any vehicle.
This would include the use of the universal "thumb out" signal as well as using a sign of any kind. Interestingly, it is NOT illegal to "hitchhike" if you are on the sidewalk. The definition above says you can't stand in the roadway.
What's a roadway vs. sidewalk? The vehicle code tells all:
530. A "roadway" is that portion of a highway improved, designed,
or ordinarily used for vehicular travel.
555. "Sidewalk" is that portion of a highway, other than the
roadway, set apart by curbs, barriers, markings or other delineation
for pedestrian travel.
Now that we've covered all of that...hitchhiking is incredibly dangerous for both the pedestrian seeking a ride and the driver who offers the ride.
For Odd Job - a person waiting for a ride from a known individual is not soliciting a ride from passing traffic. Likewise, if you stop for a stranded motorist, regardless of whether you offer a ride or he asks for one, as long as he was not soliciting passing cars for a ride, it's not hitchhiking (in CA). Your description of a motorist-turned-pedestrian doesn't qualify as hitchhiking since his purpose (apparently) is to walk to a location where he can get aid.
In my mid-twenties I thought I'd be kind on a very cold night and give a female hitchhiker a ride in a warm car. She was just 17 and a mercenary. As soon as we were a block away, she told me to give her money or she would scream rape. I fibbed and told her I only had six bucks to which she replied something like "You've got a car". We dickered just long enough for my goal which was to reach the highway overpass. She started screaming, ripped the front of her blouse and tried to hit me a few times.
So I pulled into the left turn lane to enter the freeway... and stopped. I got out of the car with the keys and leaned back against the hood. The flashers were going and the car was in a well-lit, well travelled area. Within about 1 minute she was gone, running down the road. I waited and a local sheriff's unit stopped a few minutes later. I explained what happened, let him look around in the car where he recovered a cheap necklace and two buttons. They caught her and she had "hitched" all day from S.F. to San Jose. Her purse contents included about $350 in cash, several wedding rings, three men's watches, two ladies' watches and other items of dubious ownership.