Dear Ilyas Ahmad,
Welcome to the Wefugees Community and thank you for sharing your question.
In my state you would't be deported if your girlfriend is 37 weeks pregnant and the authorities (Ausländeramt, Regierungspräsidium) have been shown proper documentation (Sorgerechtserklärung & Vaterschaftsanerkennung). Since I'm not staying in Bayern the best would be to contact a local organization (maybe local Migrationsberatung or Flüchtlingsrat Bayern https://***.fluechtlingsrat-bayern.de/).
When the child is born you are entitled to a recidence permit as a parent of a german child (Aufenthaltstitel als Vater eines deutschen Kindes). The most important requirement for that will be that your identity is proven so you'll need definitly a Passport and most likely a birth certificate. Those documents will also be necessary to get a proper birth certificate for the child. Just enquire from the local Standesamt.
I hope my answers were useful for you and I'll be very pleased if you contact me again with further questions. I'm a member of the mbeon-staff and I‘ll be glad to guide over a longer period of time. Mbeon is an online consultancy for migrants via the mbeon-app, which you can install on your smartphone for free. Download it via App Store or Google Play Store. You'll find me In the mbeon-app and get confidential one-to-one advice in a safe virtual room, where nobody can wiretap messages. For more informations: ***.mbeon.de.