Using the expansion connector pins directly will work with NPN proximity switches
(the expansion port pins have pull-ups to 5V)
_BUT_ if you make a wiring mistake (connecting to >7V or < -0.5V) even for a microsecond
or you have a EMI issue and large voltage spikes on the wiring, you will damage the FPGA
Safer to use the field inputs with a 2K 1 W pullup to 24V