The people who found him collecting wood brought him before Moses, Aaron, and the rest of the Israelites.
These men are to judge the people on a continuing basis. Major issues they can bring to you, but they can decide all the small matters themselves. In this way your burden will be made lighter as they share it with you.
During the time the Israelites were wandering in the desert, a man was caught collecting firewood on the Sabbath.
They placed him under guard because it wasn't clear what should happen to him.