Unfortunately, you cannot get your inspection costs back. This is why these foreclosed properties are somewhat a gamble. There are often title issues, etc which are not found out until an attorney researches the property for a buyer to close on it. Did you have a buyer's agent working for you?
Most of the time the bank needs extensions. They make the buyer be ready to close and then wait and wait until they are. There are many things they need to get into place before they can close.