I think the Robot didn't break the 2nd Law.
Here's how I imagine the Robot working:
The Robot continuously checks for the 3 Laws.

Law 1: The Robot has to save either will smith or the child.
Since the child has a lower chance of surviving he chooses Will.

Law 2: The Robot has to obey humans:
Will tells him to save the girl.
The Order is ignored because Law 1 has higher Priority.

Law 3: He doesn't harm himself so who cares

It seems like the first Law lets him ignore Law 2 and 3 and the second lets him ignore Law 3.
Ignoring is not the same as breaking the Rule in this case because **Law 2 specifically states that it can be ignored**.
Thus it's not broken.