Contact with Wild Animals
Pets, especially hundreds of millions of cats and dogs, live in close contact with humans. They tend to get into contact with wild animals, especially birds and rodents. It may be for hunting, playing, feeding or just curiosity about a decaying carcass. This may become a serious issue if the virus circulating in birds would be better adapted to mammals, enabling mammal-to-mammal transmission on a large scale. One such H5N1 variant has been found in a red tailed hawk, but the results are not peer-reviewed yet. The almost simultaneous H5N1 outbreaks on more than 30 fur farms in Finland also suggests such a virus variant. A variant circulating in birds with a PB2-T271A mutation can be considered confirmed after the test results from the mixed farm in Brescia, Italy. The confirmed spillover from cows into wild birds is another risk.
Contact with Livestock
Exposure to infected cows and especially consumption of raw milk on dairy farms is a new and significant risk for cats. Many cats live on farms not as pets, but mostly to reduce the local rodent population.
Stray and Feral Populations
Large numbers of cats and dogs live to some degree as strays or feral. Those animals could act as a reservoir for a virus adapted to mammals. For example there could be long chains of transmission in the stray cat population before the virus occasionally reaches free roaming cats living in households.
Food Contamination
Cat food contaminated with H5N1 has infected cats in South Korea. The cat food based on poultry was not properly disinfected. The risk from commercial cat or dog food is very low, as it is usually properly cooked and disinfected.
Another case in Poland may have been caused by contaminated raw poultry meat being fed to the cats, but the cause is not confirmed. It is worth reading this post for further details.
Prevention
The most effective measures to prevent infection of your pet are keeping it away from birds and not feeding raw meat, especially poultry. This means keeping cats indoors and dogs on leashes. While H5N1 infections in dogs can be mild, a more recently infected dog died from H5N1. This may depend on the exact virus strain or type of dog. However, documented cases of dogs infected with H5N1 are very rare. A preventive measure that won't bother your pet is keeping shoes outside the home to avoid dragging in any infectious material, especially bird feces. Another one is to prevent contamination of food and water sources by placing them under a cover. Guidelines on how to keep birds and other pets safe can be found here, here and here.