Ferrules are used to attach the casing to its mounting points. They are typically made of metal or plastic and have mounting features that allow them to be securely attached to a mating surface. Ferrules often contain an internal bearing surface for the flexible shaft fitting to rotate upon-this bearing could be a ball bearing or an oilite type bearing.
Ferrules give axial and torsional support to the casing. Without the ferrule the casing would just float on top of the rotating shaft, being free to rotate to a certain degree due to the friction between the shaft and the casing. The ferrule prevents this from happening.
Also, the ferrules can be used to create an environmental seal, keeping moisture, dirt, and dust out of the inside of the casing and away from the flexible shaft.