Window and door spray foam a good solution for this exterior section underneath a window?
Great Stuff foam will not last exposed to the elements and it's not water resistant it's mainly an air barrier. My suggestion is to cut a piece of treated lumber to fit space. It looks like a 2x4 will fit between sill and slab. It can be rip down to be flush with to outside edge of the sill.  Run a good bead of caulking first to the inside then install board and finish sealing.