One way would be to that the companies interview you in your countries. This usually happens with on-campus recruitment.
Other way is that you are on some other visa (other than B-1), that does allows you to solicit, give interviews, etc. For example at the end of F-1 study visa, you can go around and shop for some time to get a job, and the company will then sponsor for your H1B.
Actually, at the end of an F1 visa, provided that you got a degree, you can work under OPT for 12 months, with a possible 17 months extension if you're in STEM.
At the end of those (12+17) months you can seek H1B.
Other way is that you are on some other visa (other than B-1), that does allows you to solicit, give interviews, etc. For example at the end of F-1 study visa, you can go around and shop for some time to get a job, and the company will then sponsor for your H1B.