This is a horsehair worm. It manipulates the mantis to seek water so it can complete its life cycle. This process nearly always results in the death of the mantis—either by drowning, severe internal damage, or neurological impairment caused by the parasite.
Mother Nature. How lovely.