umm, I'm not sure what you were expecting to happen.
Do you have certificates set up for automatic login? Otherwise your login is going to get tangled up in the pipe. And foo doesn't take or use any input. It might be interesting to pipe it to tee and have that call foo. It won't do what you want, but it might show you more output.
If you set up certificates and then pass the command you want run with the ssh, then you can get the output and use it. There is an example in this thread:
http://www.linuxquestions.org/questi...ht=ssh+command
basically,
$ ssh
user@server.domain "command" 2>&1 | foo
or pipe to a file and then process the file. " | tee -a filename" shows the output of the script and also appends it to the file. Subsequent commands can then process what's in the file.