The majority of Catch and Hatch Pokémon in the game fall into one of two categories: Common and Rare. The mechanics that determine the encounter rates of each of these Pokémon are outlined on this page. A handful of Pokémon have special mechanics associated with them; this page will detail all such encounters. Information about Groudon, Kyogre, and Rayquaza can be found here.
Jirachi is only obtainable in the Ruins area, by getting the Jirachi Arrival option on the slots. The Ruins location itself requires the player to Travel six times to access. When the player triggers Jirachi Arrival, Jirachi will appear on the field and float around for thirty seconds. The player must hit it three times in order to catch it.
Because triggering Jirachi's appearance relies on the player getting its option in the slots, the Sapphire field is recommended, since the player can use the Zigzagoon there to stop the slots.
Pichu is obtainable as a Hatch Mode catch on either field. It will only be a Hatch option once the player has captured 5 Pokémon in the current game (indicated by the number at the bottom of the screen). Pichu is also generated as the Hatch encounter separately from all other Hatch Pokémon. The mechanics for encountering Pichu work as follows:
In order for the remainder of 0 divided by 50 to be 0, only 2 values of the possible 100 work: 0 and 50 itself. This means that Pichu has a 2% chance before the player has defeated Rayquaza. After defeating Rayquaza, 100 is used instead of 50, and only 1 value will result in a 0 remainder: 0 itself, meaning Pichu has a 1% chance after defeating Rayquaza.
This information is based on my interpretation of the still-in-progress pret decompilation project for Pinball Ruby & Sapphire; the relevant part of the code is located here. If I am misunderstanding what I'm reading, please contact me to issue a correction.
Text of this section largely written by Retn of the pret discord and modified by me. Used with permission.
A special encounter is checked for every time the player enters Catch Mode. To be able to trigger a special encounter, the following conditions must be met:
If both conditions are met, then a special encounter has a 1% chance of being selected in Catch Mode. This chance is raised to 2% if the player has beaten Rayquaza in the current game or if they are using the 'Encounter Rate Up' e-Reader card.
If a special encounter is chosen, the game will select from the available Pokémon: Aerodactyl, Chikorita, Totodile, Cyndaquil, Latios (Ruby board), and Latias (Sapphire board). If the player has not yet registered all available special encounters as 'caught', the game will select the first species that has not yet been caught, in the order listed below:
If all available special encounters have been caught, the species selected is random.
This video by gmedley also offers a good explanation with visuals of the process followed here.
Note: Aerodactyl, Chikorita, Totodile, and Cyndaquil require the player to have registered them as 'seen' or 'caught' in order for them to be available as special encounters. The only way to register them as 'seen' is to use the 'Special Guests' e-Reader card, or to use link play to connect to someone else who has them registered. Therefore, these four Pokémon are completely inaccessible without the use of the e-Reader card, link play, or hacking.
If the 'Special Guests' e-Reader card is used, the first catch the player makes on the board is guaranteed to be one of these four Pokémon, selected at random by the game. If the player has registered at least one as 'caught' but not all four, the game will only select a Pokémon that the player has not yet caught. Otherwise, if the player has not caught any or has caught all four, they have an equal chance of being selected.