Hi @Hassan-14
It is not clear from your question what kind of residency status you have at the moment. If you get a residency permit for work purposes or become a German citizen, then yes your wife can change from Ausbildung visa to spouse residence permit. The requirements for this are different whether she is applying as the spouse of a foreign person with a residency permit or the spouse of a German citizen.
If a person becomes pregnant during an Ausbildung, then they are legally protected like other workers. She will have to inform her employer and if necessary ask the immigration authority (Ausländerbehörde) for an extension of her permit. There is a period of 6 weeks before the birth and 8 weeks after the birth where the mother is not allowed to work in order to protect her health. This is called ‚Mutterschutrzfrist‘. After that there is the possibility to take parental leave ‚Elternzeit‘. An important condition if extending the residence permit is that she has enough money to support herself during the entire extension period.
Here you can read more about the protection during Ausbildung in cases of pregnancy:
https://***-ihk-de.translate.goog/potsdam/aus-und-weiterbildung/rechte-pflichten-benefits-ausbildung/schwangerschaft-und-elternzeit-in-der-ausbildung-2332968?_x_tr_sl=de&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp
Best,
Éanna