The man was not innocent, and this was not an accident. He was intentionally breaking a law of God. His sin deserved punishment, and God's punishment for him was just because anyone who sins is deserving of death.
Some argue that the Bible is contradictory because it says that God is holy and rightoeus, yet it seems unfair that God would have a man killed simply for gathering sticks on the Sabbath, which is what Numbers 15:32-36
Numbers 15:32-36- 32 While the people of Israel were in the wilderness, they found a man gathering sticks on the Sabbath day. 33 And those who found him gathering sticks brought him to Moses and Aaron and to all the congregation. 34 They put him in custody, because it had not been made clear what should be done to him. 35 And the Lord said to Moses, “The man shall be put to death; all the congregation shall stone him with stones outside the camp.” 36 And all the congregation brought him outside the camp and stoned him to death with stones, as the Lord commanded Moses.
Numbers 15 is not a case of a man not knowing what the law was and simply innocently gathering sticks on the Sabbath. It can be assumed that he knew the law of God and was intentionally breaking God's law in breaking the Sabbath.
The Bible teaches that the just punishment for sin is death.
Romans 6:23- For the wages of sin is death, but the free gift of God is eternal life in Christ Jesus our Lord.
Because every human has sinned, God would be just to punish any human with death at any time. So, it was just for God to end the life of this man because he deserved death for his sin.
If we say that God was being unfair in punishing this man with death, then we are imposing our own moral standard upon God. God is the sovereign creator, which means there cannot be a higher moral standard that God must submit to. Since God Himself is the ultimate moral standard, whatever God chooses to do is by definition right and just.
If you simply don't like what God has chosen to do, that is simply not a good argument. You must demonstrate why God was not fair to do what He did. Where do you get your moral standard from, and why is it legitimate?
In the end, we will find that no moral standard outside the Bible can withstand philosophical scrutiny.
Some people have trouble accepting possible explanations to alleged contradictions in the Bible, especially ones that they consider a stretch. For example, Dan Barker, president of the Freedom From Religion Foundation, says this:
I have received numerous replies from Christians who think that these contradictions are either trivial or easily explained. Yet not a single "explanation" has been convincing.
The fact is that there are plausible explanations for every alleged contradiction in the Bible. That there is a plausible explanation for an alleged contradiction does not mean that it is definitely the correct explanation for the alleged contradiction.
However, as long as a possible explanation has been suggested, then it has been objectively demonstrated that there is no necessary contradiction regarding the Bible verses and passages brought up.
When people like Dan Barker say that they don't find a particular explanation for a contradiction "convincing," then that is merely their opinion. A plausible explanation has been suggested that eliminates the necessary alleged contradiction. They simply don't like it, which is not at all a relevant argument against the explanation.
To read more about solutions to Bible contradictions and difficulties, check out Norman Geisler's The Big Book of Bible Difficulties: Clear and Concise Answers from Genesis to Revelation. While we do not agree with some of Geisler's theology, particularly concerning his view of predestination, this book is still an excellent resource. It is thorough and filled with research.
Another book to check out is Tim Chaffey's Demolishing Supposed Bible Contradictions: Exploring Forty Alleged Contraditions, which also answers many alleged contradictions in the Bible.