What does "fancy being" mean?

As Sven mentioned, the verb fancy here means to imagine. It doesn’t here mean the secondary sense to like as it sometimes can (nor even the rather less common tertiary sense of to breed, as in pigeon fanciers or orchid fanciers).

The paywalled OED entry gives these relevant subsenses:

I. With reference to mental conception.

  1. trans.

    • 1a. To frame in fancy; to portray in the mind; to picture to oneself; to conceive, imagine. Also (with notion of fancy n. 3), to suppose oneself to perceive.

    [subsenses 1b, 1c, and 1d omitted]

    • 1e. In colloq. use often in the imperative as an exclamation of suprise. Also absol.

So this is an example of sense 1e; it’s being used as imperative exclamation of surprise much as if had been written:

Why, just imagine being ridiculed!