In most Faculties you don't have to. Only in the School of Business and Economics doctoral candidates must be enrolled for at least two semesters. An enrollment might be recommended also for international doctoral candiates for using the student service facilities or due to visa matters.
You will find further information about the enrollment on http://www.graduateschool.uni-erlangen.org/doctoral-research/enrolment.shtml.
Please note that you should register your thesis on https://www.docdaten.uni-erlangen.de/gradschool_en.html regardless of whether you are enrolled as a student or not.