First of all you need a machine which meets the following requirements:
This machine can be a server that you both have access to(e.g. VPS in the cloud) or the computer of one of the participants if you are in the same network.
I will refer to the two participants as Alice and Bob.
Alice and Bob both ssh's into the common machine:
ssh user@common_machine
Then Alice runs:
tmux new -s shared_sess
And Bob runs:
tmux attach -t shared_sess
Now when Alice writes something in the terminal Bob will see it and when Bob writes something Alice will see it.
But they can't work at the same time while in the shared session, only one can be active.
If this isn't desired see next setup.
Alice and Bob both ssh's into the common machine:
ssh user@common_machine
Then Alice runs:
tmux new -s alice_sess
And Bob runs:
tmux attach -s bob_sess -t alice_sess
Now both Alice and Bob have their own session but each can access the session of the other one.
This means that they can work at the same time but can still see what the other is doing and do stuff in the other one's session.