When cut, onions release a mix of compounds, including a gas that, when it comes into contact with the moisture in your eyes, converts to (a mild) sulfuric acid.
Sweat can also contain a mix of these same compounds, although not nearly as strong (typically) as onions.