(Adding a new answer as there have been significant changes to the game since previous answers.)
As mentioned before Kerbals in a stable orbit will happily stay put, until disturbed or rescued, in the stock game.
Rescuing stranded Kerbals is now easier with new features from version 1.1 onward:
Grabber Claw
Allows a form of docking when rescuing Kerbals and craft without docking ports, by grabbing a Kerbal or craft.
Kerbals and resources can then be transferred between the craft, the claw released and the Kerbal taken home.
Whole craft can be taken back to Kerbin if the rescue craft has enough thrust and fuel to either refuel the stranded craft or tow/push it. A big enough rescue craft can even re-enter while holding the stranded craft, bringing it, the Kerbals, and the full science value, home.
EVA Construction Mode
With the addition of Engineer Kerbals ability to build in space and cargo storage in 1.7.1 expansion and 1.11 you can repair and improve a stranded craft.
Load up the rescue craft cargo space with fuel tanks, small engines, solar panels, and maybe a heatshield. For un-Kerballed stranded craft take a probe core. Once close dock/grab the craft or EVA an Engineer, and add the necessary parts to get the stranded craft mobile.
Resource transfer and Fuel Ducts
Transferring fuel can be complicated if the stranded craft has tanks separated by certain structural components or heatsinks which prevent the normal resource transfer.
Engineers in EVA construction mode can either:
- Attach fuel ducts across the gaps
- Ferry fuel across gaps by attaching a small fuel tank/battery/science pod/resource container, switching to the craft, transferring resources to it, switching back to EVA, detaching the tank, carrying it to the target tank, attaching it, again switch and transfer, repeat as necessary.