I highly recommend that you buy the policy, especially given that it is a foreclosure sale. There could be all sorts of title issues that require a trained eye to locate and there are all sorts of issues that could arrise that you might need the policy.
It is not necessary, unless your lender requires it. But it is highly advisable. There are many other concerns you should have. A trained attorney or Realtor can help. There are often ways of insuring over exclusions to the title policy. Just ask your title insurance company. Be sure to shop around. Some title companies are not insurance companies, though they may appear to be, thus they exclude everything except for what is public record. There could be wild deeds, or pending liens, disputed borders or special assessments not on record.
If I was personally purchasing the property, I would purchase the title insurance. Typically the cost of the insurance is minimal, and the protection is worth the price. Make sure that the policy you are purchasing is providing adequate coverage. This may mean asking the closer, or your realtor (and if you don't get adequate advice from these people, hire an attorney) to explain what the exceptions to the policy are, and whether they can be deleted from the policy.
Remember that the title insurance policy goes beyond a typical contractual guarantee of clear title. For one thing, the title insurance policy will often cover your defense if you are sued relating to the property, or your costs to litigate title issues.
If you have any further questions, please do not hesitate to contact me. www.cameronkellylaw.com