Actually your problem is a slightly different one. Simply copying "foo" from system A to, say, your home directory on system B (even if they are running the same OS and HW architecture) does not automatically let you run it.
"foo" needs to be installed in a directory that's in your $PATH. For instance, $HOME/bin or /usr/local/bin.
Also, depending on how you transfered the file, it may no longer be "executable" on the target system. For instance, FTP does not preserve the "exeutable" permission bits. So make sure that you can run the file:
$ chmod 755 $HOME/bin/foo
These two requirements may well be annoyances to novices (although they are there for a good reason).