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.
That makes sense. Although, I’d imagine if you’re trying to escape, your sentence is likely for a considerable amount of time, so any additional time for stealing, vandalism/destruction of property, etc, won’t hurt you too much.