This phase II trial studies the effect of androgen ablation therapy with or without niraparib after standard of care radiation therapy in treating patients with prostate cancer that has not spread to other parts of the body (localized) or that has spread to nearby tissue or lymph nodes (locally advanced). Androgen ablation therapy (also known as hormone therapy) lowers the levels of male hormones called androgens in the body. Androgens stimulate prostate cancer cells to grow. There are 2 types of androgen ablation therapy given in this study: AAP + ADT and Apa + ADT. AAP + ADT is the treatment combination of the drugs abiraterone acetate and prednisone (AAP) given with androgen deprivation therapy (ADT, also known as androgen deprivation therapy or androgen suppression medication, which is used as standard of care to lower testosterone levels in men with high risk localized or metastatic prostate cancer). Apa + ADT is the treatment combination of the drug apalutamide (Apa) given with ADT. Androgen ablation therapy with or without niraparib after radiation therapy may help to control the disease in patients with prostate cancer.