Can I use a MOSFET switching circuit to trigger a digital input (that reads +24 V as high) with an Arduino Mega 2560 R3?
Is this a viable way to do it?


Yes. The KUKA digital input is, most likely, an opto-isolate type so it will require about 5 to 10 mA to drive the opto-LED. Your R1, 1k resistor will drop 5 to 10 V when powering the input so check the KUKA input specifications for that. When Q1 is on R1 will dissipate P = I^2R so check that you've got a comfortable resistor rating for that.
Note that the logic is inverted with this configuration. GPIO on = KUKA input off.


Is the resistor necessary to draw the current towards the pin?


The KUKA input requires current to operate. R1 provides it. (The input draws current from the supply via R1. The resistor doesn't &quot;draw current&quot;.)


Besides a relay is there any other way to do it with a MOSFET, specifically?


Yes.

Use a high-side switch. That will get rid of R1 and give full 24 V to the KUKA input.
Use an opto-isolator but then there is no need for the MOSFET.

KUKA robots are expensive. KUKA robots are industrial. The right way to do this is use an industrial opto-isolator between your microcontroller and the robot. This keeps the supplies isolated and makes it very unlikely that one will damage the other.

Photo 1. A selection of DIN rail opto-isolators.
You'll be looking for one with 5 V input. The outputs are usually transistors and, since they are floating, can be used for PNP or NPN inputs. These are also DIN rail mounting which will suit most control panels.
Using a cheap microcontroller to control an expensive robot seems a bit strange. Using a PLC would give a more robust and industrially hardened solution with the benefit that it would have much longer term support than your microcontroller code.