Pumping milk from the breast into a container (as opposed to the baby’s mouth) for the purpose of using the milk is usually prohibited on Shabbat (or Yom Tov). If the milk is discarded or made unfit for use, then it is a rabbinic prohibition. In cases of pain or illness, the halacha makes exceptions.
Therefore, to answer your question, it depends what the purpose of the pumping is. When the milk is required to feed an infant who is ill or has difficulty nursing, then an individual question should be asked. The ruling will depend on a number of factors, such as the infant’s age and condition.
In cases of maternal illness (e.g., breast infection, engorgement), it would be permitted to either express the milk for discarding (straight into sink for example) or into a container with soap in it.
When not permitted to pump, the best option is to express prior to the Chag – by hand or with a pump. If you cannot get enough on Erev Shabbat ot Erev Yom Tov, you can express ahead of time and save the milk. You can keep breastmilk in the refrigerator for up to three days, or you can freeze it for more long-term storage.
If one is allowed to pump, one can express by hand, use a manual pump, or use an electric pump on a Shabbat clock if one is able to put the breast on the pump before the Shabbat clock turns it on. (In addition to ruining the motor, leaving the pump on for all of Shabbat increases the halachic difficulties because putting the breast on the pump starts the pumping process directly. This is more of a problem than just being in position when the machine goes on.) An individual question should be asked in each case. If the milk is needed for a sick infant, the baby’s condition may be a factor in determining which method is preferable.
Please see our video here for further discussion of this topic.