If you short it to ground with the button pressed you will "crowbar" the supply voltage down
to 0V and possibly weld the switch shut.
The issue is the infinite (almost) input resistance of CMOS inputs. At room temperature
inputs have a resistance around 10^10 or 10^11 ohms, so that stray electric fields will
dominate the voltage on the pin - just bringing your finger near will affect the pin
voltage.
The resistor clamps the pin to 0V while the button is open, whilst also limiting the
current that flows when the button is pressed. Any value from 100 to 100k will
work (larger values may allow noise pick-up if the button is mounted on long wires).
Low values waste power, so 10k is a reasonable compromise.