We don't really know that, all we saw was the kid claiming to be sick in Carol's class, excusing himself, then walking thru the prison coughing, then going into the prison to take a shower. It's there where he collapses and apparently dies. We really don't know the time frame between the death and when he reanimates............
As a side note, we have seen many instances where a killed person reanimates very quickly.....Shane being a prime example.
Walkers killed by “natural” means seem to come back faster. Those who die of the bite take a bit to come back. Andrea’s sister for example.