If app is rejected from App Store, is it possible to have a refund for Developer Program? I'm about to register to the 99$ Apple Developer Program.

If for a reason Y or Z, the app is rejected from AppStore, can I ask a cancellation and refund of the Developer Program?

The reason is that it wouldn't be useful to stay on Developer Program if the app is not accepted.

Note: If needed, I would do the cancellation before 7 days after the subscription to the Developer Program. (In Europe, or at least some countries, there is a right of withdrawal/cancellation up to seven days after an online purchase).
In general, there are no refunds of the Apple Developer program yearly fee.  I've been in the program for several years and I've never heard or seen a refund given because an app was rejected.

The reason being is that all app policies are public and available for you to review prior to determining you want to pay the fee and submit the app.  I would recommend that you do that first and see if your app idea is viable.

Just because you think the app will be accepted doesn't mean Apple can't reject it later for whatever policy they think you violated.  In that case, you can always contact Apple and appeal the rejection. 

I don't know if the 7-day cancellation you mentioned would be applicable in this case because you're not making a product purchase; you're paying a membership fee.