Theoretically, it is meant to imply that one person's loss is another person's gain. For example, if you are long XAUUSD, then someone is short, if you are on the winning side, someone else (not the exact opposite trade, could be multiple traders) is on the losing side, losing that money.
But it is not a zero sum game. It is a negative sum game, because the sum of money deposited by traders, let us say is X, then the net money that comes out is a percentage of X, less than 100%.
This is because you have brokers, liquidity providers, market makers that charge spreads, commissions & fees that gets deducted from the total sum of money. There are all sorts of charges from payment gateways to banks.
It is a negative sum business. The total money deposited by retail forex & CFD traders (same for other traders & other markets) minus total money that comes out is not zero, if that makes sense.