This issue falls into both the family law and real estate law areas, but I will just address the real estate law angle. As co-owners, you both have full rights to use and enjoy the property. That means that if you want to move back in you have every legal right to do so. This, of course, may not be feasible from an emotional standpoint or a practical standpoint if he forcibly excluded you.
Your husband's claim that you have "abandoned" the house has no legal merit.
When you say that the house has "been in foreclosure" I assume you mean there is an active foreclosure lawsuit against you and your husband as borrowers. If so, you need to see an attorney immediately to determine where you stand in that case. There are many potential options you might have, including a loan mod, short sale, or stipulation with the lender. If you have any equity, it is even more important to take prompt action.
From the family law side, the house is marital property and is equally yours and his. Your husband, absent a court order giving him exclusive use and possession of the house, cannot legally keep you out of the home.
This answer is offered for informational purposes only. It is not offered as, and does not constitute, legal advice nor does it constitute an attorney-client relationship