Source: https://www.grunge.com/1172545/why-it-is-legal-to-attempt-to-escape-prison-in-germany-and-some-other-countries/

According to Half As Interesting’s YouTube video Why Breaking Out of Prison Is Legal in Germany, the Reichstag, which was 1880s legislative body of what was then the German Empire, declared people’s right to self-liberation, which included the right to attempt to escape if imprisoned. Countries that recognize this right consider the right to freedom and the right to seek freedom as separate entities that are not governed by the same laws.

This isn’t to say that if you do manage to escape from prison you’re guaranteed freedom from then on; if authorities find a prisoner post-escape, they can bring them back to jail to finish out the rest of their sentence. However, no additional time will be added to the sentence; the attempt isn’t punished in this manner.