20. Animals or fowl that are not yet trained to return to their pens (or
cages) in the evening, and even those that had once been trained, but then
rebelled and ran away, may not be forced into their pens or into the house
on Shabbos (1). Furthermore, even if they are in one's home or in their
pen, but the door is open, it is forbidden to close it on Shabbos, thereby
trapping them inside, because that would constitute a violation of the
prohibition against trapping.
(1) One of the 39 avos melachos (prototype prohibited activity on Shabbos)
is trapping an animal ("Tzeida").