It's just a reflection. Like in 2D (on a straight Y axis, like in the image) you would just flip the sign of the x and y position relative to the intersection point (the portal center).
But it can be more complex when the wall is in 3D, or not straight on an axis. You could use the classes Transform and Basis to do the reflection.
https://docs.godotengine.org/en/stable/classes/class_transform.html
https://docs.godotengine.org/en/stable/classes/class_basis.html
But I'm about to go to sleep, so this is a bit much right now. Maybe I can write some code tomorrow.