In most cases, you have to fulfill most or all of the following conditions:
- a valid Aufenthaltserlaubnis or Aufenthaltsberechtigung residency permit
- legally resident in Germany for at least 8 years
- a livelihood-guarantee of you and your dependants without recourse to social welfare or unemployment benefits (exceptions are made for people under of 23 years)
- adequate knowledge of the German language
- on oath on the German constitution
- you have to give up your former citizenship (although there are exceptions to this)
Spouses and children can often be naturalised even if they have not been living in Germany for 8 years. For spouses of German citizens the couple must be married for two years and the spouse resident in Germany for three years before the application can be made.
More information can be found here.
Children: German Citizenship by Birth
German citizenship is determined by inheritance from parents and not by place of birth. Children with a German mother or father are automatically citizens at birth. But not all children born in Germany are automatically German, in fact, there are 100.000 non-German children born every year.
If both parents are foreigners then the child only gets German citizenship automatically from birth if one or more of the parents has been legally living in Germany for a period of 8 years and has a valid Aufenthaltsberechtigung or has had an unbefristete Aufenthaltserlaubnis for a period of three years. These children get German citizenship of as well as that of their parents and then have to choose which citizenship they wish to keep at the age of 18.