You can also create 6 Cubes for each side of the wall and connect them with the “player cube” logic bricks. Each time the player collides with one of the walls you “move” the player cube to the other side.
Of cause you need to know the distance, but this also works dynamically
I support Blackwood111’s idea with a modification.
You add an offset to the according coordinate.
For example: Collision with +X plane -> add -100BU to X, coordinate
You do not even need python to do that, just six sensors with six motion actuators with dLoc set. Ensure the added offset does not place the object right into the opposite wall (should be a bit smaller than the dimension of the cube.
While I write that I think one object with six materials (for each site) might be fine too.