yes, you have a chance to stay in Germany as a father of a German child. First of all you must have an acknowledgement of paternity (Vaterschaftsanerkennung) und it is also very important to make a statement of child custody (Sorgeerklärung), if the mother agrees to that. The first you can make in Standesamt or Jugendamt, the second only in Jugendamt, therefore it is better to make an appointment in Jugendamt and make both documents there.
If you already possess these documents, you must give them your Ausländerbehörde together with the copy of Mutterpass (Mother book with the preliminary birth date) and inform them that you will be a father of a German child soon. It is especially necessary if you are in real danger of deportation.
As soon as the child is born, you give the proof to the Ausländerbehörde and you can apply for a residence permit (family reunion to a German child). The general rule for family reunion is through an application in the German embassy in your country but in case of a new born baby (especially a German baby) they can make an exclusion. The reason is that if you go abroad and the visum procedure takes much time, it is bad for developing of your relation to a child and for a child's well-being. How good your chance is, depends on your Ausländerbehörde, some Ausländerbehörden give a residence permit in this case without making problems and some insist on your leaving Germany and making a visum procedure. In this case you can make an objection (Widerspruch) against the negative decision (better with a lawyer) or you can ask the Ausländerbehörde to give you a written confirmation of their agreement to your family reunion (so called Vorabzustimmung). With this document you have a good chance to make a family reunion from abroad really quickly.
It is very important that you find a good councelling center for these questions in your place because in the online consultation it is not possible to evaluate your case individually, in every detail.
Please try to contact a good lawyer.Thanks