Hi @Neerajsharma7880
As long as you are sick, the main thing is to keep your company and school (Berufsschule) informed and get a sick note (Krankenschein) from the doctor to cover your period of sickness. If you need to extend your Ausbildung, then you can also extend your visa as long as you are able to support yourself financially and as long as the Ausländerbehörde feels there is a good chance you will complete your Ausbildung successfully.
Regarding potentially losing the Ausbildung, a company can only dismiss someone due to sickness in certain circumstances. For example if a person is briefly absent for sickness very often over a two-year period (at least 45 times). Or if a person has a long-term sickness and there is no reason to expect any improvement in their situation over the course of the Ausbildung.
The other matter is with the exams. If a person has been absent a lot, then they may not be allowed to sit the exams. The decision for this rests with the relevant trade chamber fort hat profession. Each profession has a different ‚trade chamber‘. For software development I believe it is the IHk.
The IHK can refuse to allow someone to sit the exams. This depends on the amount of absence from school and company, the academic marks and performance up to the point, and possibly a statement from the person themselves.
These two articles provide some good information about sickness during an Ausbildung (in English via online translation):
https://***-azubiyo-de.translate.goog/azubi-wissen/krank-in-der-ausbildung/?_x_tr_sl=de&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp
https://***-personalwissen-de.translate.goog/auszubildende/ausbildungsrecht/arbeitszeit-ausbildung/zu-viele-fehlzeiten-in-der-ausbildung/?_x_tr_sl=de&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp
If no longer wish or no longer can continue the Ausbildung, then you can apply for a work visa or a study visa. You can switch visas without completing the Ausbildung. In either case, you will have to show you have enough money. For the work visa it must be a qualified job and for studies you will have to be accepted to a university programme.
Hope you get well soon!
Best,
Éanna