The device does not need a ground wire to work, and understanding why makes the rest obvious.
A ground fault interrupter compares the current flowing out on one conductor with the current returning on the other. In normal operation they match. If some current is escaping by another route — through a person, through a damp wall — the two no longer balance, and the device cuts the supply within milliseconds at a very small imbalance.
Notice that nothing in that description involves a ground wire. It is measuring a difference between two conductors it already has.
So for protection of people against shock, which is the thing that hurts you, this genuinely works without a ground. Many electrical codes explicitly permit exactly this replacement in ungrounded systems, on the condition that the outlets are labelled to say there is no equipment ground. Those labels usually come in the box, and fitting them is part of the job rather than an optional extra.