Deformable image registration (DIR) is a popular technique for the alignment of digital images, with highly relevant applications in medical image analysis. However, the numerical solution of DIR problems can be very challenging in computational terms, as the improvement of the DIR solution typically involves a uniform refinement of the underlying domain discretization that exponentially increases the number of degrees of freedom. In this work, we develop adaptive mesh refinement schemes particularly designed for the finite-element solution of DIR problems. We start by deriving residual-based a posteriori error estimators for the primal and mixed formulations of the DIR problem and show that they are reliable and efficient. Based on these error estimators, we implement adaptive mesh-refinement schemes into a finite-element code to register images. We assess the numerical performance of the proposed adaptive scheme on smooth synthetic images, where numerical convergence is verified. We further show that the adaptive mesh refinement scheme can deliver solutions to DIR problems with significant reductions in the number of degrees of freedom without compromising the accuracy of the solution. We also confirm that the adaptive scheme proposed for the mixed DIR formulation successfully handles volume-constrained registration problems, providing optimal convergence in analytic examples. To demonstrate the applicability of the method, we perform adaptive DIR on medical brain images and binary images and study how image noise affects the proposed refinement schemes.