For most types of consumer debts, creditors must first take it to court and get a judgment against you. After they do that, they may be able to take money out of your bank account but the procedure for that varies under state law. In addition, there are some situations where creditors are able to seize funds from your bank account to pay debts.
I'm not sure what type of debt you are dealing with here, whether there was a court judgment against you, and whether the collection agency's action was legal. It would really be a good idea for you to consult with a consumer law attorney in your area who can answer these questions for you.