If the opponent hides Guards at the battlefield, can they still play the sand soldier at the base when they react with the hidden card?
No, they cannot.
According to RiftJudge FAQ #9273 and RiftJudge FAQ #9517, when you play Guards! from its hidden position, the Sand Soldier token must be played at the same battlefield where the Guards! card was hidden.
This is further supported by Rule 811.1.d.3, which states: "If a hidden spell or a play effect of a hidden permanent causes you to play a unit, you must choose to play that unit at that battlefield [where the card was hidden]."
Because the card was hidden at the battlefield, the token must enter play at that battlefield; it cannot be played to your base.