Replacing the battery or even simply disconnected the battery on a vehicle will cause the engine control unit (ECU) to reset and clear all the emission monitors (and trouble codes; if any existed). Emission monitors are needed to be READY or COMPLETE in order for the vehicle to pass the smog check.
Completing or making "Ready" the emission monitors requires driving a car through a specific driving pattern. Emission monitors are internal self-tests which the ECU performs to ensure a vehicle is not polluting and is running efficiently. The entire process of self-testing various emission control systems is called a Drive Cycle.
It is recommend to drive a vehicle 200-300 miles and over the course of a few days in both city and highway traffic conditions in order to make the emission monitors "ready".