The word "foo" may be a corruption of F00 ('F'-zero-zero), which Data General Corp. used as a generic file example in its documentation in the '60's and '70s. Examples would refer to file F00, F01, etc.
However, it is unlikely that the above etymology is correct. There is some discussion at http://catb.org/~esr/jargon/html/F/foo.html.
FUBAR is a military acronym meaning "Fucked Up Beyond All Recognition". I always assumed the use of foo and bar as MetasyntacticVariables derived from this. That doesn't seem to be the case either.
FUBAR itself has also been suggested as drawing inspiration from German furchtbar ~= awful.
I suspect it's one of those memes that survives because there are multiple "reasons" behind it that reinforce each other.
The Data General idea is an interesting one, but is discounted by the fact that many programmers when attempting to illustrate an example, throw us Foo, and then the following variable, is always, invariably, Bar. Hence, FUBAR, and that is without a doubt, the answer to, what is Foo.