Laws of Cricket 1947 Code - Law 33
A Batsman may retire at any time, but may not resume his innings without the consent of the opposing Captain, and then only on the fall of a wicket.
Note on Law 33
1. When a batsman has retired owing to illness, injury, or some other unavoidable cause, his innings is recorded as "Retired, Not Out", but otherwise as a completed innings to be recorded as "Retired, Out".
Reproduction of the Laws of Cricket is by kind permission of Marylebone Cricket Club