I have two answers. The first is, yes they can do and unless you have some state requirement stating otherwise. They owed you what was on deposit, you owed them for the overdraft and your deposit agreement with them says setoff is permissible.
The only catch is dependent on your state debt collection laws. At some point there is a statute of limitations on when a non-active debt may no longer be collected. You'll have to find out what that is with research. If the time had not passed, as was noted you can ask for some of that back by making arrangements for payment. The bank is under no obligation to do this, however.