It depends on the corporate structure. Unfortunately, S-Corps don’t allow foreign ownership.
If the corporation were modified to become a C-Corp or an LLC, then you could own a nominal percentage as an H-1B visa holder.
There seems to still be much confusion about H-1B holders being able to work for their own companies. That’s because the USCIS hasn’t always been clear or consistent in its interpretation and enforcement of the rules. To address the confusion, the USCIS issued this memorandum and these clarifications regarding an H-1B visa holder’s ability to also own part of the company s/he works for.
You can learn more about H-1Bs from this piece I wrote.