This study proposes an online walking-pattern generation algorithm with footstep adjustment. The algorithm enables a biped walking robot to effectively recover balance following external disturbance. The external disturbance is measured as a capture-point error, and a desired zero-moment point (ZMP) is determined to compensate for the capture-point error through a capture-point control method. To follow the desired ZMP, the optimal ZMP and the position of the foot to be changed are determined through model predictive control (MPC). In the MPC, quadratic programming is implemented considering a cost function that minimizes the ZMP error, the constraints that the ZMP maintains within the support polygon, and the constraints on the varying foot positions. The proposed algorithm helps a humanoid robot (DRC-HUBO+) to regain balance following disturbance, i.e., from strong pushing or stepping on unexpected obstacles.