It is possible to stay on in Germany if you do not finish your Ausbildung. It depends, however, what type of residence permit you would then apply for. You refer to continuing to work with your employer after stopping the Ausbildung. What kind of position would you be working at in that case?
If you have a job offer that requires a qualification, for example Altenpflegerin, you have to show you have the qualification for it. Do you already have a qualification from your home country or from Germany before starting this Ausbildung? Then you can apply for a permit as a skilled worker without having to return to your home country. You may need to have the qualification recognised in order to work in that profession in Germany.
If, however, your employer is offering you to continue in an unqualified position, this will not be enough for you to be able to change your permit.
You could as an alternative also consider changing to a different Ausbildung in the same field (e.g. Altenpflege) that doesn’t take so long, since you have already successfully completed one year.
Is there any reason in particular you are wondering about what would happen if you do not pass? Are there parts of the Ausbildung you are finding difficult? There are various extra supports available to people doing an Ausbildung. One option is ABH (ausbuildungsbegleitende Hilfen) which is a support service offered by the Agentur für Arbeit. This enables you to get some extra tutoring and personal support during the Ausbildung.
In addition, there are also specific projects for foreigners in many parts of Germany to support people not just with finding an Ausbildung but also to support them during it. Perhaps in your area there is also such a support service.
If the German language is an issue, there are in some places special part-time evening courses especially for people doing an Ausbildung who need some extra help with the language. Here is an example of one in Berlin: