One idea of where this phrase comes from is the telephone and its handset. Click here for that explanation.
Another possibility is found in fishing. It's much more literal. Just as a fish released off the hook is released from the obligation of being someone's meal so is a person who has been let loose from a responsibility, they are off the hook.