Forecasting the response of ecological systems to environmental change is a critical challenge for sustainable management. The metabolic theory of ecology (MTE) posits scaling of biological rates with temperature, but it has had limited application to population dynamic forecasting. Here we use the temperature dependence of the MTE to constrain empirical dynamic modeling (EDM), an equation-free nonlinear machine learning approach for forecasting. By rescaling time with temperature and modeling dynamics on a "metabolic time step," our method (MTE-EDM) improved forecast accuracy in 18 of 19 empirical ectotherm time series (by 19% on average), with the largest gains in more seasonal environments. MTE-EDM assumes that temperature affects only the rate, rather than the form, of population dynamics, and that interacting species have approximately similar temperature dependence. A review of laboratory studies suggests these assumptions are reasonable, at least approximately, though not for all ecological systems. Our approach highlights how to combine modern data-driven forecasting techniques with ecological theory and mechanistic understanding to predict the response of complex ecosystems to temperature variability and trends.