LOS ANGELES—After reports recently rippled across California’s agricultural heartland that immigration agents might audit farms, Bryan Little of the California Farm Bureau Federation sent an email alert to thousands of farmers warning them not to run afoul of a new state law governing their interactions with federal immigration officials.

The law requires California employers to ask immigration agents for warrants or subpoenas before allowing them access to private areas of the workplace or confidential employee records. Employers...