It refers to the legal or judicial act of confining someone as a punishment for committing a crime or violation of the law. In the context of modern legal systems, מאסר can be temporary or long-term, depending on the severity of the offense.
In a spiritual or metaphorical sense, the word can sometimes be used to describe being trapped or confined by one's own negative traits or habits