You have a couple of options to ensure that you are insured while driving your friend’s car.
First, you can ask your friend if they add you as a short term driver to their policy. Many policies include the possibility to add a short term driver at no or very small cost. You friends can contact their insurance and just get your name added. The exact length and amount of additional driver differs by insurer.
Second, your could be insured through your own car insurance policy or can get a temporary car insurance policy (Zusatzpolice Kfz-Versicherung) yourself as some insurers do not offer the option to add another driver. Contact your insurer directly, Joonko does not offer any temporary coverage.
If you and your friend forgot about the insurance and an accident occurs, your friend is still insured. However, your friend’s insurance might impose fines such as increasing the deductible, reducing their no-claims class, and terminate their insurance. Your private liability insurance might cover for the additional costs but ultimately your friend will have to pay all costs first.