The decision to show the "very sensitive" papier mache sculpture by Austrian artist Ines Doujak comes after the director of Barcelona's Museum of Contemporary Art reversed an earlier ruling.
"The opinions of many and various sectors of society, from the world of art and culture to politics and the media as well as international professionals from the world of art convinced me to go back on my first decision not to inaugurate," Bartomeu Mari said in an open letter.
The sculpture shows the former king, who abdicated in June 2014, being sodomised by the late Bolivian union leader Domitila Barrios, who is in turn being sodomised by a dog.
The artist said at the time that the work aimed to "play with power relations and subvert them".
More From This Section
Mari had originally asked curators to withdraw the piece from the Beast and the Sovereign exhibition of 30 works by international artists, according to Spanish media.
They refused and instead pushed him to either show it or cancel the whole exhibition.
Mari has offered his "sincere apologies" as well as his resignation to the museum over the decision.
"I never saw what I did as censorship," he said in his letter.
The exhibition opened to the public yesterday.