Homeowners Insurance is a necessary important part of getting and holding a mortgage and banks will require you to get homeowners insurance for the life of the mortgage.
But yes it is possible to be denied a homeowners insurance policy and homeowners insurance for a variety of reasons.
Some reasons that a insurance company may deny someone homeowners insurance are, existing problems with the home, bad location, high crime rate in the area, age of home, bad foundation or other foundation issues.
Another reason that people can be denied homeowners insurance cover are outdated wiring, old plumbing, no central heat or even having a wood stove can cause an insurance company to deny you homeowners insurance coverage.
You may also be denied homeowners insurance coverage due to poor or bad credit since the insurance company will use your credit score and credit rating to determine if you're good or bad risk.
Having a bad or low credit score or other negative remarks on your credit report can tell the insurance company that you're a bad risk to them so they do not want to insurance your home.
If you cannot get coverage for homeowners insurance then you may not be able to get a mortgage but you may also find some insurance company if you're lucky to cover your home through homeowners insurance with bad credit but you'll have to shop around the internet and maybe go into a local insurance company office.