Automatic add space if user enters number(any digit)

This kind of questions is better asked on StackOverflow community.

Maybe this JS hack would help:

var elem = document.querySelector('.search-form input[name="search_keywords"]');
if ( null !== elem ) {
    elem.onchange = function() {
        var e = this
          , v = e.value;
        if ( ! v ) return;
        v = v.toString();
        if ( 0 === v.indexOf(0) ) {
            v = v.substring(1);
            var zero = true;
        }
        v = v.match(/.{1,3}/g);
        v = v.toString().replace(/,/g, ' ');
        if ( zero && v ) v = "0" + v;
        if ( v ) elem.value = v;
    }
}

Add it to your main JS file or to the footer using wp_footer action hook