The law, which takes effect from 1 January, was conceived as a way to crack down on so-called “kitten factories” and “puppy mills”.
Such “high volume” operations that breed animals for profit have been associated with inhumane conditions and long-term health problems for the animals.
Known as AB 485, the bill means pet shops will have to provide records of each animal’s origin or face a $500 (£391) penalty.
Californians will still be able to purchase non-rescue animals from private breeders.
The Pet Rescue and Adoption Act was originally introduced by assembly member Patrick O’Donnell and signed into law by California governor Jerry Brown in October 2017.
Mr O’Donnell said the law was a “big win for our four-legged friends”, and also for taxpayers, given the $250m (£196m) spent every year to house and euthanize shelter animals in the state.
The legislation requires each shop to maintain records on all dogs, cats and rabbits, and post “in a conspicuous location on the cage or enclosure of each animal” a sign outlining where they came from.
It also states shops must comply with laws that require animals to be spayed or neutered.According to the American Society for the Prevention of Cruelty to Animals (ASPCA), more than 6.5 million pets are placed in shelters in the US every year, and 1.5 million are put down.
Judie Mancuso, president and founder of NGO Social Compassion in Legislation, welcomed the law when it was first suggested as “a bold step forward”.
However, the change was opposed by the American Kennel Club, which argued it would mean more people purchasing pets that were not a good match for them.
Critics think the new law would make it difficult for prospective owners to find popular breeds, noting that the genetic and medical histories of shelter animals are not always known. Others have suggested it could put shops out of business.
While California is the first state to enact a state-wide law, other areas have brought in similar legislation at a local level.
The move comes after the UK government confirmed the introduction of a similar ban on third-party puppy and kitten sales in England.
Under the plans, currently out to consultation, those wanting to buy pets under six months old will have to choose a rescue animal or visit a private breeder.
Dubbed “Lucy’s Law” after the case of a mistreated cavalier King Charles spaniel, the legislation was also intended to crack down on low animal welfare standards in the breeding industry.
Battersea’s chief executive Claire Horton welcomed the move against “unscrupulous puppy dealers lining their pockets with no regard for animal welfare”.
She said: “Properly enforced, this will help put an end to dogs being used as breeding machines and kept in shocking conditions.”