Law 2.9(b): Retired
If any batsman leaves the field of play without the Umpire's consent for any reason other than injury or incapacity, he may resume the innings only with the consent of the opposing captain. If he fails to resume his innings, he is recorded as being Retired - out. For the purposes of calculating a batting average, retired out is considered a dismissal.
Retired hurt
If a batsman is injured or falls ill while batting, he may retire and resume his innings at the dismissal or retirement of another batsman. If he cannot return by the end of the innings, the batting side must close its innings after all other batsmen are dismissed (excluding the not-out batsman). This can occur if the batsman requires medical attention away from the ground. It is therefore possible for the side batting last in a match to lose despite only losing nine (or potentially fewer) wickets. For the purposes of calculating a batting average, a scorecard entry of 'Retired, hurt' or 'Retired, ill' is considered not out.
Only two batsmen have retired out in an international cricket Test match. Both instances occurred in the same match, with the Sri Lankan batsmen Marvan Atapattu and Mahela Jayawardene.
2nd Match: Sri Lanka v Bangladesh at Colombo (SSC), Sep 6-8, 2001 | Cricket Scorecard | ESPN Cricinfo