Yes, it's a button on a string. But, it's really an escape button compass from the Second World War.
Like a normal button, it was sewn on the uniform. A solider could remove the button, which is magnetized, suspend it on a pin and a pre-determined mark on the button would face North. Some of these buttons may have also been floated in water to achive the same effect.