Nonstructural brick like yours gets installed with a gap between it and the wall. There are little ties back in there that fix the brick parallel to the wood wall. There should be drainage for the gap at the base of the wall. Searching the internet for brick wythe wood wall assembly drainage I found https://www.gobrick.com/media/file/28-brick-veneer-wood-stud-walls.pdf which looks like a nice tutorial for a homeowner with nonstructural brick.
After confirming that your wall has functioning drainage along its base, remove that spray foam, buy and install some backer rod that fits snug in your gap, and caulk that opening with an exterior rated sealant.