My bandsaw follow and cut a straight line, but vertically, it almost immediately shifts the bottom part to the left and cuts a weird angle where the cut i'm making on like a 10" tall block of foam ends up being almost 1/4" left of where it is at the top, with the line I'm following. and it's not the angle of the table. Once the cut is done, the blade shifts back into place and holding up my 10" piece to it shows a large gap between the top part of the foam and where the blade is normally.
I know this is an old question, but there's other possibilities that haven't been explored here.
A bandsaw blade isn't rigid like most saws and are subject to twisting, which is why many people use them for scrolling cuts. However, there are reasons why the blade can twist when you don't want it to.
First is the use of "excessive" pressure. I put "excessive" in quotes because it's completely subjective here. It depends on the material you are cutting, the thickness and width of the blade, tooth size and pattern, blade tension, and a few other things.
On a vertical bandsaw, the pressure is up to the operator, so if you are pushing on the block of material fairly hard to get it to cut, then you could be causing the blade to twist. Even a small amount of twist is enough to get the blade to end up far off the line.
On a horizontal bandsaw, which I'm assuming you are using due to your description, the pressure is regulated by a spring and a tensioner. You'll need to adjust the tensioner to make sure the weight of the arm isn't putting too much pressure on the material, causing the twist. This can take a bit of trial and error to figure out. It can also take some trial and error with a vertical bandsaw, but it's a bit easier to see what's going on due to it's orientation and manual use.
Just to cover all bases, make sure your blade is tensioned appropriately to help minimize the possibility of it twisting. A blade that doesn't have enough tension will easily twist under pressure.
Also, too much pressure will try to engage the teeth too quickly, cutting too much too fast, and filling the tooth too fast so that it clogs. This leads to the second possibility.
The teeth are getting clogged. When this happens, the teeth are more or less skating around on the loose material, and the only thing really cutting into the material are the sides of the teeth. The loose material, the chips/shavings/filings/sawdust/whatever-you-want-to-call-them, often end up essentially becoming ball bearings and push themselves between the tip of the tooth and the solid material. On really soft material, this can also cause tear-out, further pushing the blade sideways, instead of in the intended direction of the cut.
On a piece of metal or wood, you'd notice that the chips are escaping the teeth by going around the blade on the opposite direction that the blade is side-cutting. You'd see the chips start to pile up on top of the blade within the kerf.
Clogged teeth can be caused by a mismatch between the material, the tooth size, and pressure on the blade. It doesn't always mean that the teeth are clogged when they enter the material, but also while they are in the material trying to cut it. When the gap between teeth gets filled before the teeth can exit the material, you have a clogged tooth. This is because the blade is trying to cut too much too fast and there's not enough room in the tooth to hold the chips/etc. before the blade exits the material and the chip can be ejected/removed from the tooth.
This can be exaggerated when cutting something long or tall with a long distance between where the teeth enter the material and where they leave. On thin material, the teeth enters and exits quickly, so it can remove the chip quickly, but on longer cuts, the chip has to stay in the tooth for longer.
On something like foam and even wet woods, where the material has a lot of friction or is sticky, the chips can ball up when there's too much of them and just start trying to escape out the sides of the cut, causing even more twisting and side-slip of the blade. This can happen even if the teeth aren't clogged, but it's so much worse when they are clogged.
One caveat: just because the chips are going around the blade, it doesn't necessarily mean the teeth are clogged. Some blades are designed to allow chips to do this. On metal cutting blades, the teeth are often not completely aligned and will "wave" around a bit. This is usually on very fine teeth, with the idea that the blade is going to be in the material for a long distance and specifically won't have a chance to clear the tooth before it clogs. So they make the blade able to clear the teeth while still in the material by letting the chips slide around the blade on purpose and in a calculated way.
That doesn't mean these blades are incapable of having clogged teeth or that they won't still slide sideways during a cut, but they are engineered to minimize that risk.
Some wood blades will also have this "wave tooth" feature, but you'll want to watch out for the sides of the blade not letting go of this material, as well as the sawdust darkening. That darkening, if you don't already know, is it burning. You'd want to slow down your blade or reduce pressure to help prevent that problem.
With something as soft as foam, I'd suggest a very large toothed blade designed for very soft woods. I'd also suggest very little pressure on the blade. Both of these suggestions will help the blade cut without cutting too much at a time, helping to prevent clogged teeth, and prevent blade twist. Doing both at the same time will work even better.
This will take some self-control to manage. On foam, you'll see it cutting so quickly that you'll want to put more pressure on the material to cut faster, which will just twist the blade again. You'll need to find a "sweet spot" and stick with it, just like with any other material. And with something as soft as foam, there may be little difference between "too much" pressure and "too little" pressure, where you don't end up cutting anything.
On a horizontal bandsaw, the tensioner might not be able to be adjusted with a light enough pressure, so you might have to hold up the arm manually.