Cold compresses should be applied within 24 hours after a foot sprain to reduce swelling and relieve pain.