You may be sure means "you may be certain". I can explain it word by word: "You may be", as a form that allows you to do something or ensures you in doing it. "You may be sure" means that you are allowed to be sure, that there's no mistake in being sure. So, in the phrase "and she wasn't best pleased, you may be sure, when the prince told her that he was going to marry her stepdaughter..." it means "you can be certain that she wasn't best pleased when the prince told her that he was going to marry her stepdaughter ".
Hoping to be clear,
Helen