There are different regulations in each state as to when compulsory school attendance ends or when a pupil can be released prematurely from compulsory education upon application by the school board. Some federal states (Bremen, Hamburg, Sachsen, Rheinland-Pfalz and Sachsen-Anhalt) have a uniform compulsory education with a duration of twelve years. It's eleven years in Hamburg. During this time, students must attend a full-time school. After nine years (ten years in Bremen) compulsory education can also be fulfilled by attending a part-time school (vocational school).
The obligation to attend a school in Thüringen usually ends with passing a diploma at the end of the 9th grade, but is immediately followed by an obligation for secondary education. For details see: http://apps.thueringen.de/de/publikationen/pic/pubdownload1245.pdf