Depending where you are, the original window frames may have been set behind the outer bricks. This became the norm in London after 1666.
Readymade modern frames may not fit, though if custom made they should.
I think it is a gap, not a cavity wall.
Expanding foam is often used but decays in sunlight and holds damp. Silicone sealant can be used for cracks and narrow gaps but looks bodgy over about 8mm wide. You must keep water out. Mortar is likely to fall out.
If you can make a wooden batten to cover the gap, you can inject foam in the gap behind it. The wood protects the foam. I can describe a good method if this appeals. Will you be DIYing?