Is it actually illegal to escape from a prison or will it just have effect on increased sentence in practice? I heard something that in Sweden where I live it is not illegal to escape, but is that no matter what you did?
Chapter 26 section 7 of the Swedish Penal Code points to a possible consequence of prison escape:
If the sentenced person seriously violates the conditions for the serving of the sentence in a prison, the date for conditional release may be postponed. Such a postponement may amount to at most fifteen days on each occasion of use.
Aiding an escape is a specifically-identified crime, but apparently the act of escaping is not, though is would have a negative consequence (we would say that such a treatment is an "infraction", not a separate crime).
This article in fn. 7 indicates that it is not a crime in Germany, and The Interwebs tells me the same thing. Mexican law explicitly declares that there is no penalty for prison escape (Article 154, with translation from here)
To the prisoner that to escape (from prison) will not be given any penalty, except when it’s in complicity with one or more other prisoners and they perform violence on other people, in which case the penalty is six months to three years in prison.
It is a specific crime in the US (governed by individual jurisdictions). The state of Washington in RCW 9A.76.110 makes general prison escape a class B felony. Adjacent provisions increase the severity of the crime if the person is a sexually violent predator (9A.76.115), reduces the crime if it is escape from detention (not pursuant to a conviction), and further reduces the crime if it is just escape from custody (e.g. escapes from the drunk tank).