Using 24V ground when using internal pull-up resistor

(deleted)

I am not at all sure what you mean. Can you draw a diagram.

Using a 24V system your grounds have to be connected together. In that case as long as the input does not exceed 5V then it is fine to use the internal pull up resistors.

Is this 24V output an NPN open-collector output? It would need to be to allow direct connection. Anything else and an opto-coupler is probably the simplest robust solution.

If the grounds cannot be commoned, again opto-coupler...

(deleted)

That looks like a very convoluted way to attach a button to the Arduino - is the button physically located in the 24V system then? You could bring Arduino gnd and pin connections in to the button, ignore the 24V supply completely.

(deleted)

If you are using an opto I would not connect the two grounds together. Keep the opto output ground just to the arduino ground keep the opto input ground just to the -ve of the 24V system. That way you have maximum isolation.

(deleted)

The Arduino side of the opto isolator need to be connected to the Arduino side.

The 24V side needs a connection to the 24V ground.

You don't need a common ground. A common ground generally won't hurt, but with a common ground you don't have isolation. (However, with a common ground the Arduino is still protected from the 24 Volts.)