We propose a simple, robust protocol to prepare a low-energy state of an arbitrary Hamiltonian on a quantum computer or programmable quantum simulator. The protocol is inspired by the adiabatic demagnetization technique, used to cool solid-state systems to extremely low temperatures. A fraction of the qubits (or spins) is used to model a spin bath that is coupled to the system. By an adiabatic ramp down of a simulated Zeeman field acting on the bath spins, energy and entropy are extracted from the system. The bath spins are then measured and reset to the polarized state, and the process is repeated until convergence to a low-energy steady state is achieved. We demonstrate the protocol via application to the quantum Ising model. We study the protocol's performance in the presence of noise and show how the information from the measurement of the bath spins can be used to monitor the cooling process. The performance of the algorithm depends on the nature of the excitations of the system; systems with non-local (topological) excitations are more difficult to cool than those with local excitations. We explore the possible mitigation of this problem by trapping topological excitations.