CE
In general it makes legal sense if you have your original purchase money loans (never refinanced)which are non-reocourse or if you have only one loan which you can get protection under the one-action rule. It’s quite a bit more complex than that but that is the general jist of it.
Beyond that there are personal and financial considerations. For example, if you are a business owner even though your FICO scores can come back, a foreclsoure will show up on your credit history and will impact your future access to capital among other things.