Abel Magwitch has escaped from a prison barge and is at large on the Romney Marshes. He isn't familiar with the area, and so he doesn't know where he might hide from his pursuers. This makes it almost certain that he will be recaptured. A detachment of soldiers is already out looking for him, and surely it's just a matter of time before they capture him.
Under the circumstances, Magwitch has no choice but to remove his chains if he's to stand any realistic chance of avoiding his captors. Without being weighed down with chains, he might be able to get away. It's a long shot, but it'll be worth the effort if he doesn't have to go back to that prison barge.
But this is easier said than done. Magwitch needs tools to help him remove his chains—the kind of tools that, say, a blacksmith would have. It's a real stroke of luck, then, when Magwitch comes across a young lad, Pip, whose brother-in-law just happens to be a blacksmith. Magwitch uses this fortuitous encounter as an opportunity to threaten Pip into bringing him a file for his leg irons, as well as some much-needed food and drink.
Although Magwitch is subsequently recaptured, this was his only realistic chance of escaping.