You should keep your pond filter running 24/7. Whether that’s a mechanical filter, pond gravity filter, UV pond filter or something else, you should install it and leave it running all day every day.
As long as you buy the right type and size of pond filter for your situation, there is no danger to the fish or other life in the pond if you leave the filter running 24 hours a day.