Aceh is the only region in Indonesia, the world's biggest Muslim-majority country, that imposes religious law.
On Thursday, a 22-year-old man -- sentenced to 100 strokes -- pleaded with a masked Sharia officer to stop lashing his back with a rattan cane before he fainted.
He was revived and given brief medical attention and then the flogging continued. He was later rushed to a nearby hospital for treatment.
The man had been found guilty of having sex with a woman who was also sentenced to 100 lashes outside a mosque in Aceh Timur district, along with another man she had relations with.
Some 500 jeering spectators watched the punishment as some yelled "harder, harder".

In July, three people were flogged 100 times each for having premarital sex, while two men caught having sex with underaged girls were also whipped 100 times last year. Other offences tend to carry dozens or even fewer lashes.
In October, Aceh officials announced that poachers who threaten endangered orangutans, tigers and other wildlife could receive up to 100 lashes under new rules.
Rights groups have slammed public caning as cruel, and Indonesia's President Joko Widodo has called for it to end, but the practice has widespread support among Aceh's mostly Muslim population.