yes....ssh sets up the variables in your terminal session for the X server/client communication to work. you could have set those up yourself as well. X needs to know the endpoint for the communication..which in the end is an ip address and port number.
the hardest line to type correctly is: stty erase ^H