The bank is foreclosing on your home. Knowing you're going to lose it, you figure you'll just take everything that you can with you. You'll tear out the cabinets and sell them on Craigslist. You'll rip up the carpet and put it on eBay. You'll take down the light fixtures, pull down the trim, break off the tiles, and sell anything you possibly can.
Is it legal?
It's not, at least not if you go that far. You can take your personal property out of the house, along with furnishings and other things that are not nailed down. But you can't take everything.
Essentially, most of your fixtures are considered to be part of the house itself. Taking them is illegal because the bank is reclaiming that house, which they'll then try to sell. They expect it to have light fixtures, a kitchen sink, and everything else.
Things that aren't nailed down, that you bought and moved into the home when you arrived, are just furnishings. They were yours before you owned the house and they still are, generally speaking.
This can get tricky. If you bought a microwave and set it on the counter, you can likely take it. If the house came with a built-in microwave, it probably has to stay. It may seem like a small distinction, but the home simply needs to be in good condition when you move out, not stripped down to the point that other buyers wouldn't want it.
Instead of putting your energy into trying to keep the bank from getting some of your items, you may want to look into your options to stop foreclosure and save your home.
Source: The Balance, "Things an Owner Can Legally Remove From a Foreclosure Home," Elizabeth Weintraub, accessed May 31, 2017