Foam sandwich construction is useful in the building industry. You can make quite rigid building panels out of it that have built-in insulation. The skin takes bending loads while the foam core gives it shear strength.
It's also used in boat construction, but more often with a honeycomb core than expanded foam. This type of material is especially useful for racing yachts where you want a high strength to weight ratio.
This type of sandwich construction is generally known in engineering circles as a composite beam. That doesn't necessarily mean it's super strong, just that you get reasonable stiffness from a light weight structure. There are plenty of stronger construction materials available, but there's a weight penalty. For example, I have a steel boat. If I was involved in a collision with a honeycomb composite racing yacht, I might knock a bit of paint off my boat, but would more than likely punch a hole through the racing yacht and sink the bloody thing. But mine is a cruising yacht where light weight is less of a priority than strength. A mate once described my boat rather un-kindly as a shipping container with a pointy front end welded on.
I can't see foam filling being particularly useful in something like a "normal" alloy motorcycle frame or swing-arm. You're looking for high strength and stiffness, and typically that's achieved with reasonably thick-walled metal tubing. Filling the inside of the tube with foam isn't going to improve it by much.
However, it would be useful in a large, thin-walled box section type of structure, mainly to keep the sides of the box from buckling and also give it a bit of shear rigidity. I'm thinking of something like a monocoque carbon fibre box filled with foam. It's been done before though, so it isn't a new concept. Have a look at a Ducati MotoGP bike or even as far back as the early 1990s with John Britten's V1000.