The relationship between magma generation and the tectonic evolution of orogens during subduction and subsequent collision requires self-consistent numerical modelling approaches predicting volumes and compositions of the produced magmatic rocks. Here, we use a 2D magmatic-thermomechanical numerical modelling procedure to analyse rapid subduction of a narrow ocean, followed by Mediterranean style collision, which is characterized by the gradual accretion of lower plate material and slab migration towards the orogenic foreland. Our results suggest that magmatism has a large-scale geodynamic effect by focusing deformation throughout the entire subduction and collision process. The rheological structure and compositional layering of the crust impose a key control on the distribution of magmatic rocks within the orogen. Compared to previous simplified homogeneous crustal models, a compositionally layered crust causes an increase in felsic material influx during continental collision and results in shallower magmatic sources that migrate with time towards the foreland. Changes in the deformation style may be locally driven by magma emplacement rather than by slab movement. ... mehrOur modelling also demonstrates that the migration pattern of the deformation front and the magmatic arc relative to the location of the suture zone may be driven by lower crustal indentation in the overriding plate during early stages of collision. The modelling predicts a gradual change in magma source composition with time from typical calc-alkaline to ones associated with relamination and eduction during subduction, collision and slab detachment. This transition explains the compositional changes of magma their temporal and spatial migration, as well as the observed link with deformation in the Dinarides orogen of Central Europe selected as a case study.