Having a form of godliness. This implies that the persons described professed to be religious, worshipers of God in outward form. A godless church is described.
But denying the power thereof. Rejecting its power. Their lives are not molded by it.
From such turn away. This implies that some of this formal, godless religion had begun to show itself even at that time.