In some contexts they're the same but in others they aren't.
If you mean the stuff (the 'head') at the top of a glass of beer, then they're pretty much the same, although it's usually called froth.
Froth is a bubbly substance that usually forms on the surface of a liquid. This can also be called foam.
But, foam can be other things. E.g. rubber foam which is the sponge-like stuff you find in sofas. Or shaving foam - neither of these could be described as froth :)