Yes, it's legal. Many people forget about a small bank account when they move, or grow up, and there's the risk that when you're not paying attention to it someone else finds the account number and empties it. So to prevent that, the bank declares an account inactive if you haven't used it for a while.
1. After a year or two of inactivity, they should send you a letter saying that your account will be deemed inactive if you don't use it soon, and at that point you can make a small ATM withdrawal or deposit to keep it going.
2. If you moved and didn't get that letter, or you're just forgetful and ignored it, then the account becomes inactive, and you have to make a transaction to re-activate it.
3. If you do nothing for a few more years, the bank doesn't want to bother with your inactive account any more, and will turn it over to the state treasury. It's still your money, but you have to make the effort to track it down. And if you have any outstanding bills, such as unpaid income tax, the treasury will deduct what they think you owe.
All three of these have happened to me....
For your situation, #2, if you have another checking account, you should be able to mail a paper check or send an electronic check to your TD account. Call the branch where you opened the account and ask what the minimal amount needs to be and how to make it out and where to send it and how long it will take. They WANT you to close the account if you're not actively using it, so they will be helpful.
You might also be able to do a direct electronic transfer from a savings account, but again, call the bank to make sure. It could be this will be automatically rejected, since the account isn't active.
Maybe you have a relative or friend in one of the many cities where TDBank has branches who could go and make a deposit for you. Again, call the bank first to see if this would work, and if you should give this friend a note saying that you're asking them to make this deposit. I remember that the amount I had to deposit was small, but I can't remember if it was $1 or $25.