Not legal under French law, but the penalties imposed for invasion of privacy have always been quite small; typically no more than 30,000 euros; so there is a profit to be made from publishing the pictures, nonetheless.
That seems strange, but the French press has always been curiously respectful of very important people in France, regardless of any legal consequences, which may explain how various Presidents have had mistresses and one of recent memory had a child by his mistress, all of which was never reported at the time. The penalty for breach of privacy is seen as a token of disapproval that someone has broken this code.
Another factor here is the French attitude to such cases as this. They are nowhere near as concerned about toplessness, nudity, or sexual misadventures as we are in 'Anglo-Saxon' countries. There is no French 'page 3 girl' ; why would there be, when nudity and bare breasts are everywhere considered unexceptional in normal magazines and newspapers and in advertising? It is a fair guess that a photograph like this will not be regarded as anything serious in terms of a breach of privacy.