According to Marxist theory the individual soldier usually is working class since class is not defined by the function or moral evaluation but by their position within the economical and power structures.
A regular soldier does not own land, a factory or any other means of extracting profit, they are selling their own labour, they do not exercise power over their own labour other than providing it in exchange for a wage and they are usually recruited from lower/middle class.
With Marx class does not equal a political function, a soldier can be objectively working class and still be used by their employer (state) against the interest of their own class. In Marx’s theory that is not a contradiction but a feature of the state as a class instrument.

