DNA mutations in cancer can occur due to various factors, including exposure to carcinogens, inherited genetic conditions, and random errors during cell division. These mutations can result in the activation of oncogenes or the deactivation of tumor suppressor genes, both of which can lead to uncontrolled cell proliferation.