Basically, the client and the machine hosting the hidden service both connect to a rendevouz point and communicate via that. The connections to the rendevouz point are not direct. They are bounced through three nodes, with three layers of encryption, each node being able to peal off one layer before passing it on to the next.
This is why hidden services are pretty slow. Every packet has to be routed through 6 other machines, which each can be anywhere in the World.