Nothing wrong with a gap. It should not really be more than 20mm though.
I would be more worried if the window was a tight fit.
The reason for the gap is that it allows the fitter to level off the window. As for the foam it depends but most wont use foam. It takes to long but its more used...