From Bulbapedia, the community-driven Pokémon encyclopedia.
Filler episodes are used by anime and other TV shows to extend the time between the major story arcs.
In manga-based anime such as Naruto, fillers have been used to put distance between the anime and its source material, preventing an overlap which would cause trouble for both forms of the series. Filler episodes may follow a formulaic (and often predictable) plot, loosely based on a main episode, which will either enter the backstory of a certain aspect of a show (such as Rainbow Crystal saga of Sailor Moon's first season) or tell a completely new tale involving the main or supporting and even one-shot characters from previous episodes (The Garlic Jr. saga of Dragonball Z revisits the events that happened in its movie Deadzone). Fillers also may introduce aspects that may complement or contradict the canon of the original source. It is not uncommon that whole story arcs comprised with filler episodes will be used within a series in order to fill an episode count and subsquently build up to a main story arc.
In the case of Pokémon, the Orange Islands episodes were a filler arc mainly used to prolong and build up to Pokémon Gold and Silver and its correspoding seasons in the anime.
Infamously, the third, fourth, and fifth seasons set in Johto region were comprised of seemingly endless amounts of filler episodes with formulaic plots based on previous episodes. The arcs also served as way to buy time for the releases of Pokémon Ruby and Sapphire. It is sometimes thought that the Johto seasons have led to decline of the Pokémon anime itself, often refering to it as the point when the series "jumped the shark".