I would like to fill in gaps behind the wood and such
To what purpose? Are you after insulation? Or just compelled to 'fill the void'?
You absolutely do NOT want to use spray foam. It's tough to control, sticky as hell and bonds to everything. You'll destroy that shiny new bed trying to use it.
You could use open cell foam sheets (any craft or fabric store), compressed between the drawer unit and the bed. Use enough thickness that you fill the interstitial voids. The foam between the high portions of the corrugation and the drawer box will be crushed quite flat when you use mechanical fasteners to anchor your drawers.
Or just use enough to cover the perimeter of the drawer unit and leave it void in the middle.
eta
too, those voids around the side or your drawer unit are good spots to store tow straps, antennae, jumper cables and other narrow or flexible items, towels, blankets, so they don't eat up space inside the drawers.