It's a joking suggestion that the person being spoken to should feel free to do whatever he/she wants. The idea is that the speaker considers him/herself to be a roguish daredevil and so he/she is likely to do anything for amusement. Accordingly, so should the listener. The words are invariably spoken with a mischievous grin and a gleam in the eye.
It is unlikely that you will ever find out precisely where it originated.