The problem is that R2 (oh, right, you don't have component designators, you'll just have to figure out from context which one that is) is the impedance of your signal when high. This together with the input ipedance of whatever is being connected to your output form a voltage divider.
For example, using the circuit you show, let's say the output is 7 V when connected to the device. That means R2 is dropping 5 V, which means 5 mA is flowing thru it, which also means that is how much current the input of your device is sinking when held at 7 V. To compute the input resistance of the device at this operating point, use Ohm's law. (7 V)/(5 mA) = 1.4 kΩ.
To get a higher output voltage, lower R2. However, keep in mind that this comes at the cost of higher current when the output is low. Also keep the dissipation of R2 in mind. In your example, the current thru R2 when the output is low is (12 V)/(1 kΩ) = 12 mA, and the dissipation is (12 V)2(1 kΩ) = 144 mW. Note that the power increases with the square of the supply voltage. Doubling that while keeping R2 the same will cause 4x the dissipation, or 576 mW. Even a ½ W resistor would be too small in that case.
Here is one way to fix your circuit without using a lot of current when the output is low:
R1, Q1, and R2 are basically what you have now. Q2 is a emitter follower that provides much more current output than the bare R2. The output will be about 700 mV lower than the bottom end of R2, but I expect that small amount is irrelevant for a digital signal that swings to 24 V.
If you can arrange the output from the microcontroller to be the opposite polarity, then you can use this circuit:
This circuit is non-inverting, unlike your original and my example above. This has both higher output current capability and lower output voltage drop compared to the circuit above.