Before I begin, yes I'm aware that this still happens in places like Africa and in the current war with ISIS, but by and large it's not seen as something that should be allowed to happen by the world stage.
When reading about wars in the Medieval Era and earlier, most battles consisted of sieges, and if successful, the following raping and pillaging of the inhabitants. By all accounts that I've found, this seems to have just been accepted as the way things were. When did that viewpoint change? I know it was a serious problem as recently as WWII on the Eastern Front, but were those instances seen as "normal"?
So this is an interesting question that, as I see it, contains two very relevant, yet divergent, aspects. 1) When did people/the public/governments start believing that rape and pillage was unacceptable and 2) When did armies stop raping and pillaging when they would have otherwise had the opportunity?
Further complicating the matter is another factor entirely: How do we define rape? While there is the traditional concept of forcible rape, in which the man physically holds or otherwise forces the women to perform sexual acts, there are other forms of rape that are also prevalent. For example, in a situation in which soldiers of an occupying power can offer obvious advantages (up to and including live saving sustenance) to women who sleep with their solders, is that rape? To take a very stark example, is it rape if a concentration camp kapo trades sexual favors with a lower ranking inmate for food? What about an American GI who trades food for sex in the immediate aftermath of the D-Day landings in Western France? Or a German solider who trades food for sex during the Hunger Winter of 1944-45 in the Netherlands? There is a point at which this turns from rape to run of the mill prostitution, but where do we draw the line here? I don't claim to have an answer to this question, but it's worth thinking about.
Regarding the second part of the question as I outlined it above, I'm not comfortable saying that rape and pillage - or at least rape - is not still used in wartime when there are large armies occupying foreign lands. To quote Jonathan Gottschall ("Explaining Wartime Rape," The Journal of Sex Research, Vol. 41, No. 2 (May, 2004), pp. 129-136):
A partial list of countries that have been identified as loci of mass rapes conducted by military or paramilitary forces just in the 20th century includes Belgium and Russia during World War I; Russia, Japan, Italy, Korea, China, the Philippines, and Germany during World War II; and in one or more conflicts, Afghanistan, Algeria, Argentina, Bangladesh, Brazil, Burma, Bosnia, Cambodia, Congo, Croatia, Cyprus, East Timor, El Salvador, Guatemala, Haiti, India, Indonesia, Kuwait, Kosovo, Liberia, Mozambique, Nicaragua, Peru, Pakistan, Rwanda, Serbia, Sierra Leone, Somalia, Turkey, Uganda, Vietnam, Zaire, and Zimbabwe.
I would be remiss if I didn't point out that the problem of wartime rape is not limited to "places like Africa" or the Middle East, but includes countries in Europe, East and South Asia, and South America. In fact, the only continents not touched by wartime rape appear to be North America and Australia, neither of which have been touched with large scale armed conflicts during the 20th century. And before I let the Americans off the hook, there is lots of evidence that Americans committed acts of wartime rape during the Vietnam War and during World War II, so while they may not have been on the receiving end of wartime sexual violence, they certainly were on the giving end. Nor is the temporal boundary very far back, close enough to the present that their discussion oversteps this sub's 20 year rule. The atrocities in the Balkans, after all, were in the 90s and early 2000s. It's quite accurate to say that the last major armed conflict in Europe was rife with wartime sexual violence, as was the last large scale armed conflict in which the United States was involved (unfortunately, this year's 20 year rule prevents me from discussing the most recent US wars in Iraq and Afghanistan - but I'd suggest interested parties do some googling on that front).
So I'm not certain that the second part of the question, as I've outlined it, holds up under scrutiny. Wartime rape is still a problem and until we have large scale conflict that does not have problems of wartime rape, I think it's appropriate to say that its still at least acceptable on some level, even if politicians make proclamations denouncing it.
Now, what is acceptable according to military commanders and what is acceptable according to the public on the home front is another story entirely. I'm not an expert on the mass media or other such questions, so I can't really comment authoritatively on that aspect, but I would suspect that mass rape has never been considered entirely kosher to the majority of peoples. After all, half of all people are women and girls, and women and girls tend to be the victims of sexual violence many times over as compared to men (although boys as victims should not be discounted at all!) So it's likely that even in medieval times, a solid majority of individuals were against rape and pillaging, but were unable to exert their influence in such a way as to prevent or eliminate it. This leads us to the inevitable question of whether such a time has occurred in which the public was able to exert influence upon militaries to prevent said militaries from engaging in sexual violence during times of invasion and occupation. To my understanding, this has not yet been the case, certainly not up to the point that this sub's 20 year rule begins. Rather, militaries have become very adept at hiding their actions from their contemporary publics. US rapes in Vietnam are not widely known by the US public. US rapes of French women and German women are not widely known by the US public. German rapes of Eastern women are not widely known by the German public. I can't speak for the Soviet (and later Russian) public's understanding of Soviet sexual violence, but I suspect if there ever were a case of a public believing "they deserved it" it would be the Soviets' view of the Germans in the later stages of World War II. As for all of the other cases that have occurred in the more or less recent past, I just don't have enough of an understanding of the specific instances to comment in any meaningful way. Hopefully someone else does.