I think that long ago they would have been used as slave laborers, but during the 1st and 2nd world war wouldn’t they have just been a burden? Needed to transport them, Feed them (even if slightly) make camps and have guards.
It makes sense for them to keep high ranking soldiers and such, but your average sailor or soldier?
Could you clarify what exactly you mean here? What is the alternative you are envisioning? Just what the answer is would depend on what your premise is here.
You could file this under "why would any military abide by any rules of conduct in warfare at all?" Whether that's treatment of PoWs or civilians, use of chemical weapons, what-have-you. And while war is hell, some hells are much worse than others.
Anyway, first off, if you hold PoWs then you signal to the enemy that that's an option on the battlefield. That if they determine they have absolutely no chance of winning a battle they can surrender instead of fighting to the death, and they will become PoWs. Without that escape hatch they might be more likely to fight to the death often, which incurs a much higher cost on you even if it doesn't change the ultimate outcome of any specific battle. An example here being the banzai suicide charges of Japanese troops in the Pacific War. Generally useless from a strategic perspective, but very costly in terms of casualties and equipment and supplies lost or used up while fighting them.
Additionally, if you hold PoWs you signal to the enemy that you play by a certain rule book (whether formal or informal), and that gives them incentive to hold any of your surrendered soldiers as PoWs as well. Either until the end of the war or until some mass PoW exchange.
On top of those reasons, remember that warfare is not something that happens in a box separate from "civilized society" it is a fully integrated activity. For many countries, how one conducts war is just as important as who one fights and for what reason. This can be important for public support for a war, especially in democratic countries. It can be important in being able to gain allies to assist your fight. It can be important even in having the ability to engage in international trade of resources, to get loans, or to buy armaments on the world market. WWII is a good example here, the bad conduct of Nazi Germany and Imperial Japan resulted in a lot of "closed doors" for them even from nominally "neutral" countries.
Even above and beyond all of that, killing defenseless PoWs is surprisingly hard on soldiers. Even the most savage and barbaric troops might face deteriorations in mental health or morale if faced with the routine task of slaughtering surrendering soldiers. One of the reasons that the Germans switched to the more "orderly" Final Solution system instead of just relying heavily on execution gangs (Einsatzgrupen) was because even for Nazi SS officers it was demoralizing work, it gave a lot of them PTSD, alcoholism increased tremendously, and some even had difficulty carrying out the orders. Even if you manage to winnow your forces down to the hard core nutjobs who are all-in on murdering folks, now you have a different problem, you have a group that has been selected for its efficiency in committing atrocities, not in battlefield effectiveness.