Hi @Bilal numan
I am assuming you have permanent residency (Niederlassungserlaubnis) in Germany and your wife is a Pakistani citizen.
As her visa is expired, it can no longer be extended. It is anyway only possible to extend a Schengen visa in exceptional circumstances.
She can apply for a residence permit as your wife. The authorities can then retrospectively extend her Schengen visa for the length of the application process. This is at the discretion of the authorities; they do not have to retrospectively extend it. This is based on paragraph 81, section 4 of the immigration law (Aufenthaltsgesetz):
https://***-gesetze--im--internet-de.translate.goog/aufenthg_2004/__81.html?_x_tr_sl=de&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp
The requirements for a permit as your wife are that you have enough money to provide for both of you. Depending on what type of permit you had before getting your permanent residency, she may be required to know level A1 of German.
Generally, a person has to enter Germany with the correct visa. The authorities will likely tell her to return to the UK and apply for a visa for family reunification with the German embassy there. If this is not possible, she can be allowed to stay in Germany at least for the end of the pregnancy and the initial period after birth. This period in German is called Mutterschutzfrist and in this time pregnant women are not required to leave Germany.
Your child will be entitled to a residence permit according to paragraph 33 of the immigration law (Aufenthaltsgesetz):
https://***-gesetze--im--internet-de.translate.goog/aufenthg_2004/__33.html?_x_tr_sl=de&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp
Whether your wife will receive a permit after the birth is to some extent at the discretion of the authorities. Assuming she fulfils the other requirements, the issue will be around the visa. A person is not required to leave Germany and go through the visa process is doing this can be considered ‘unreasonable’. The term for this in German is ‘unzumutbar’.
The authorities have to consider whether it is reasonable to require a mother of a newly born child to be separated from them and how long the visa process generally takes in the UK; alternatively, whether it is reasonable to require the mother to take the child with her to go through the visa process. In this case they also have to consider that the child requires a passport and a residence permit before travelling, and also whether the separation from you can be considered reasonable.
Here is a case that was recently decided upon by Germany’s Federal Constitutional Court. There it said that the family unit was more important than the visa requirement, although the case is in some aspects different than it potentially would be for your wife:
https://***-juraforum-de.translate.goog/news/bundesverfassungsgericht-entscheidet-familieneinheit-wichtiger-als-visumvorschriften_259464?_x_tr_sl=de&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp
Please note the links are in English via online translation.
Best,
Éanna