The answer is; friction due to subduction
In the subduction zone (where tectonic plates collide), when the oceanic plate is being subducted under the continental plate, there is enormous pressure and friction as a result. The pressure causes an increase in temperatures in the region that rise above the melting point of the rocks. The rocks begin to melt and the magma rises and form mountains ranges along the ridge.