A Hamiltonian system of two coupled oscillators, a linear and a nonlinear, is investigated analytically and numerically in the case when the frequency of the linear oscillator is allowed to vary slowly in time. We focus mainly on the dynamic-autoresonance (DAR) effect, i.e., a persisting phase locking between the two oscillators, accompanied by a large, though slow, energy exchange between them. The two-oscillator model is motivated by the necessity, in some applications, of taking into account the energy depletion of the driving field. The theory of the internal first-order resonances in two-dimensional Hamiltonian systems is generalized to the case of a slow parameter variation. Three constraints for the existence of DAR are found, and the theory is verified numerically. Also, several routes from order to global chaos and from global chaos to order are observed numerically.