Anisakiasis is treated by removing the parasite through either endoscopy or surgery. This may be necessary if the Anisakis worm is not naturally expelled from the body and causes intestinal issues.