Yes, it may be possible to purchase life insurance even if you have cancer.
However, it may depend on the type of cancer you have, the prognosis, how long you have had cancer, what stage your cancer is in, and how you are being treated for your cancer.
In addition, your age and health will impact your acceptance for life insurance.
But, there may be some life insurance companies specializing in high risk life insurance which may insure you for life insurance.
Also, there are guaranteed approval life insurance plans that cannot turn you down due to your health. Some of the plans offer guaranteed life insurance coverage for people age 45 to 85, if you reside in a state in which the insurance company is licensed to do business.