I think what is unacceptable is the message "if you don't look like this, you are not ready for your body to be seen on a beach" - the world doesn't want to see you unless you are this slim and toned and proportioned like this. That's unrealistic - many people could never achieve that shape (I can be a healthy weight, and perfectly capable of carrying a baby thanks, and look completely unlike that – I'm tall, athletic and flat-chested) –and also, it's suggesting only the very thin end of the weight scale is OK. Not only can you be much bigger than that and still be healthy and beautiful; I actually don't think it's OK to imply anyone is unacceptable to look at.
I don't think it's specifically, necessarily, for the male gaze, as a lot of women's concern about their appearance is to do with other women's assessment of their bodies; however it comes from a misogynist tradition and is sexist in that it's a women who'd being told to make herself look acceptable and conform to a narrow definition of what that is.
What makes it worse is that it's diet pills –I'd have slightly (very slightly) less beef with it if it was telling you to join a gym or eat more vegetables for example, because that's more about general health. Whereas diet pills are at the worst extreme of the "Panic! panic! Get thin or else!" end of the diet industry scale.
But either way, the message is "hide yourself in shame unless you look like this".