Players can announce their retirement once they turn 32 (33 for goalkeepers).

The older she is the higher the chance is that she will decide to retire.  When a player announces to retire it will always happen during the season update and the player will always play the full season ahead before retiring. 

Once a player has announced her retirement she cannot be sold.