Clearly it is either not operating as an effective deterrent or as I suspect it is an abused form of punishment.
Iran had over 300 executions in 2007 ... that is more than China and certainly more than the USA.
I don't know how many of those 30 are for illegal relationships, but it could even be as many as 28 (the article does not say).
Even hoping they had a trial does not make it easier to accept. Can you imagine the sort of trial a woman accused of adultery would receive?