Yes, the pencil cactus is toxic to pets if ingested. It contains a milky sap that can cause irritation, vomiting, and other adverse effects. Keep it out of reach of curious pets to avoid any potential issues.