Oh OK, I thought maybe we actually saw what happened and I forgot.Damaged during his escape in a previous season. Loss is described in this episode in the spoiler.
From the discussion with the Deputy, his legs were hit by bullets, he can't tell her how (because it would put the deputy's life in danger), but probably when he escaped to go to look for his son, and were damaged. In their dialog in the cave, while he eats and spits out the food, he discusses how he thought it was over when he lost his legs. His mechanical legs are in the cave with him and are detached, probably by the tools he has in front of him.