Endoscopy is crucial for cancer diagnosis because it allows for direct visualization of suspicious areas within the body, enabling early detection and accurate staging of tumors. It can also facilitate the collection of tissue samples for biopsy, which is essential for confirming a cancer diagnosis and determining the specific type and grade of cancer.