It’s possible, but unlikely. Worse case in most scenarios, the O2 sensor heater element fuse might get blown. That’s easy enough to check. Damage to the ECM, unlikely. This of course presumes all the electrical equipment was turned off, key out of the ignition when the connector was plugged/unplugged. If something is powered up during unplugging, pluggin, that could damage the ECM via an electrical pulse generated by the action. Even that tho seems very unlikely for an O2 sensor.
fyi, the recommendations by the experts here is that it is safest usually to disconnect the battery negative before doing any electrical work on cars. I always do it that way on my Corolla, and never had a problem working on the electrical system or sensors.