Arms: Take two straight sticks that should immobilize the wrist and elbow (four make a more stable splint) and hold them on each side of the arm. Use rope or a sleeping pad to keep them in place and get to a doctor ASAP. The person can spend a night with a broken arm but it is very uncomfortable (I know from experience).
Legs: Splint the leg (see above) so that the sticks go up the entire leg from below the foot to the hip (or as close as possible) If there is someone else with you, send them back to get help. If you are only hiking as a pair, the only thing you can do is to help them to get back by supporting the injured leg (they put their arm around you and you act as their leg).