There is no specific legislative provision that specifies that data gathered on electoral registers may only be retained for a set period. It is for electoral registration officers to determine how long the information should be retained having regard to relevant principles, including those set out in the Data Protection Act.
The Representation of the People (England and Wales) Regulations 2001 (S.I.2001/341), and the Representation of the People (Scotland) Regulations 2001 (S.1.2001/497), as amended, and the Representation of the People (Northern Ireland) Regulations 2008 (S.I.2008/1741) set out the regulatory regime governing access to the electoral register.
Data gathered on electoral registers are not retained centrally. However, under the regulations, relevant parts of the full register may be supplied by an electoral registration officer to certain persons and bodies for use for specific purposes, including statistical and crime prevention purposes. It is for each organisation to determine how long they wish to retain the electoral register for, and I understand national libraries retain them indefinitely.