Your ability to withdraw from a home purchase depends on two things:
1) the exact point at which you are "in contract" to buy the house, and
2) after you're in contract, what the contract says about terminating the transaction.
You are not "in contract" to buy a house until you (that's the plural "you" if you and your husband are buying as a couple) and the seller(s) have all signed your names to a purchase agreement. Getting to that point usually takes a few steps.
First, in order to place an offer on a house, you will in all likelihood deliver a written offer to the seller. That offer will likely contain an expiration date, so that if the seller doesn't act on it within a given amount of time, the offer dies by itself.
But let's assume that doesn't happen, and that you're placing an offer with a seller who would like nothing more than to sell you the house.
Just how detailed your offer document will be varies across the United States. In California, for example, the standard purchase offer is written in the form of a contract, so that the seller could sign it and boom, you'd be in contract to buy – though more often, the seller will come back with a counteroffer (also in the form of a full purchase agreement) hoping that the buyer will sign that version.
In New York, by contrast, the buyer delivers a much briefer statement of the terms being offered, and it's up to the seller to draft the full purchase agreement, which the buyer eventually signs off on.
Until both parties have come to an agreement on all the contract terms and actually
signed the purchase agreement such that you're in contract, neither of you are legally bound to anything, and you can withdraw your offer without any problem. Simply have your real estate agent get in touch with the seller's agent – most likely orally at first, quickly followed up by a written confirmation.
After you are in contract, the situation changes. You are legally bound to go through with the sale, unless one of the contingencies (conditions) set forth in your purchase contract isn't met. The earnest money deposit that you likely put down to accompany your contract may be forfeited if you fail to go through with the deal for a reason not contemplated in the contract.
As a practical matter, however, most contract contingencies provide major "outs." If, for example, your home financing doesn't come through, you could cancel the contract. Similarly, if you're not satisfied with the results of the home inspection – which is bound to turn up some defects – you can also call it quits. Talk to your real estate agent or lawyer about your exact rights under the contract, both before signing it and if it turns out that you need to cancel.
Finally, if you do need to cancel the contract and can't justify it based on one of the contract contingencies, realize that many sellers will be reasonable and not insist on keeping your entire earnest money deposit – especially when it's clear that your reason for canceling isn't mere fickleness, but due to a major change in your circumstances. Again, your real estate agent or attorney is the best one to negotiate this.
For more information, see the articles on the "Making an Offer on a House " page of Nolo's website.