If a thief, in breaking into a dwelling in the night, was slain, the person who slew him did not incur the guilt of blood; but if the same occurred in daylight, the slayer was guilty in accordance with Exodus 21:12. The distinction may have been based on the fact that in the light of day there was a fair chance of identifying and apprehending the thief.
Related Commentaries of Exodus 22:2
Exodus 22:2-4
2 If a thief be found breaking up, and be smitten that he die, there shall no blood be shed for him.
3 If the sun be risen upon him, there shall be blood shed for him; for he should make full restitution; if he have nothing, then he shall be sold for his theft.
4 If the theft be certainly found in his hand alive, whether it be ox, or ass, or sheep; he shall restore double.