Abdülhamid II, for instance, had thirteen wives. How was this seen as acceptable in Islamic society?
This appears to be an example of wikipedia being a misleading or unreliable source. Searching for an answer on this (I hadn't been familiar with the specific case beforehand) it appears that Abdulhamid had four official wives and eight additional consorts. I'm unsure where wikipedia got the number thirteen from. You can see some source examples from a google books search here: https://www.google.ae/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#tbm=bks&q=wives+of+abdulhamid+ii+eight
That's not to say that Abdulhamid II didn't go through some sort of marriage ceremony with these women or didn't treat them as his wives, as I'll detail below.
In general terms the answer to your question is that such high figures for the number of wives was typically this is a result of the fact that divorce in Islam is uncontroversial. So you may only have four wives at one time but having more than that over the course of one's life by divorce is no more controversial than Donald Trump having three wives is today in a monogamous society. In a royal setting, many of these women might well remain members of the household, even after divorce.
Ibn Saud, for instance, reportedly had 22 wives by this method, and the Saudis (particularly of that generation) would certainly have followed the Sharia more closely than the Ottomans, and particularly late-era Ottomans like Abdulhamid II (although IIRC he was personally quite pious.)
The Ottomans of course, famously, also maintained an extensive harem system whereby for most of Ottoman history the concubines were as or more important than some of the wives, particularly if they were the mother of the heir. There are cases throughout Ottoman history (and, for that matter, of other countries like Persia that had similar harem/concubine systems) of concubine-mothers maneuvering to secure the throne for their sons by killing or convincing others to kill rival potential heirs (often children) and/or their fellow concubines.
The Ottomans systematized this practice by drowning or strangling all potentially rival claimant siblings upon the succession of the new Sultan, again, including small children. This is viewed as brutal by many, but in the logic of the empire, the Ottomans, unlike European states that did not (officially) follow this practice, never had a civil war of succession. So the deaths of royal dozens once per generation, in their view, saved the lives of many more who would have perished in civil conflict.
Polygamy in Islam generally, while a prominent feature among royals, has never been particularly common in practice just because of how logistically difficult it is, made more so by the fact that in many Islamic societies rather than receiving a dowry a husband to be must pay a bride price, a practice in place even at lower levels of society.
If you want to read more on Ottoman court life I would suggest Phillip Mansel's Constantinople: City of the World's Desire. I think it has differing titles depending on your region and which edition it is.