It's generally not recommended to keep a horse in a horsebox overnight. Horseboxes are designed for transport, not long-term confinement. They can be cramped, poorly ventilated, unsafe, unsanitary, and stressful for horses.
Exceptions might include very short emergency stays in well-ventilated boxes, but a stable or field shelter is far better. Always prioritize your horse's safety and well-being.