Soap has a very high PH with all the chemicals that go into it, they are alkaline. Human eyes have a very low tolerance to alkalinity, hence the reason they are more sensitive to soap than skin. Baby soaps have a much lower PH than normal soap.
The pH level (how much something is an acid/base) is not same in your eyes than in the soap therefore it burns. Eyes are pretty neutral on the scale (7). Soap is very basic. I believe there is a chemical reaction actually happening in your eyes when the two mix.In addition, the detergent contains surfactants and dry your eyes up tears natural lubricant
Soap burns your eyes because it is at a different pH level than the membranes in your eye. Soap is a lot more basic than your eye is, meaning on the pH scale, it is usually above seven with seven being neutral, above seven being basic and below seven being acidic. Because soap is a base, it burns when it comes in contact with your eyes. In response, your eyes tear up in order to restore a normal pH balance. Also, in my opinion, another reason soap burns when it comes in contact with your eye is that pretty much anything that wasn't made to be in your eye will burn when it gets there.