When you go beyond the boundaries, either physically or morally, you transgress. A river will transgress its banks as it floods, and students who cheat transgress school rules.
Transgress sounds like and means nearly the same thing as trespass. When you transgress a rule, you're breaking it. Religions often talk about transgressing: for Christians, breaking a commandment is transgressing against God by violating his wishes. Any transgression is pushing through a boundary: like a neighbor transgressing by letting their dog into your yard: that's a physical and a legal type of transgressing. The dog got into your territory, and the owners broke a rule.