The increase in glacial cycle length from approximately 41 to on average 100 thousand years around 1 million years ago, called the Middle Pleistocene Transition (MPT), lacks a conclusive explanation. We describe a dynamical mechanism which we call Ramping with Frequency Locking (RFL), that explains the transition by an interaction between the internal period of a self-sustained oscillator and forcing that contains periodic components. This mechanism naturally explains the abrupt increase in cycle length from approximately 40 to 80 thousand years observed in proxy data, unlike some previously proposed mechanisms for the MPT. A rapid increase in durations can be produced by a rapid change in an external parameter, but this assumes rather than explains the abruptness. In contrast, models relying on frequency locking can produce a rapid change in durations assuming only a slow change in an external parameter. We propose a scheme for detecting RFL in complex, computationally expensive models, and motivate the search for climate variables that can gradually increase the internal period of the glacial cycles.