For certain actions, e.g. murder, Sharia may prescribe the death
penalty, which is implemented in some Muslim-majority countries. This
opens the possibility that an innocent person could be mistakenly
executed. This situation could be regarded as murder, and hence might
attract the death penalty too.
The judge who mistakenly gives the verdict to execute the innocent person won't get punished if he tried his best to judge justly. The prophet said:
'Amr b. al-'As reported that he heard Allah's Messenger (ﷺ) as saying:
When a judge gives a decision, having tried his best to decide
correctly and is right, there are two rewards for him; and if he gave
a judgment after having tried his best (to arrive at a correct
decision) but erred, there is one reward for him.
And if the person is executed because of false witness then those liars will have to pay him back by taking the innocents bad deeds or giving their good deeds to the innocent in the hereafter. In other words, his chances of going to paradise will hugely increase.
Umm Salama reported Allah's Messenger (ﷺ) as saying:
You bring to me, for (judgment) your disputes, some of you perhaps
being more eloquent in their plea than others, so I give judgment on
their behalf according to what I hear from them. (Bear in mind, in my
judgment) if I slice off anything for him from the right of his
brother, he should not accept that, for I sliced off for him a portion
from the Hell.
Umm Salama, the wife of Allah's Apostle (ﷺ), reported that Allah's
Messenger (ﷺ) heard the clamour of contenders at the door of his
apartment. He went to them, and said: I am a human being and the
claimants bring to me (the dispute) and perhaps some of them are more
eloquent than the others. I judge him to be on the right, and thus
decide in his favcur. So he whom I, by my judgment, (give the undue
share) out of the right of a Muslim,. I give him a portion of Fire; he
may burden himself with it or abandon it.
It is important to note that the judgement entirely depends on the judges knowledge and skills. If incompetent judges are given the power (which is happening in many Muslim majority countries) to judge, the chances of judging wrongly increases. With the use of current technology, I think it would be extremely rare for a knowledgeable judge to judge wrongly.
Currently, mistakes in judging seems to be related to lack of commitment by law enforcement forces. They can do it correctly but they don't because that takes more money. If intelligence services are utilised to solve complex cases, there wouldn't be much mistakes in judging.