It was while she was watching her daughter Barbara playing cut-outs of adult women that creator Ruth Handler first came up with the idea.
that/when refers to the whole preceding sentence which is:
It was while she was watching her daughter Barbara playing cut-outs of adult women
It was refers here to something that happened because of another thing, so it refers to the idea that came to Ruth. The reason for that idea is her watching of her daughter playing.
Therefore, and in order to get back to the point where we started mentioning the consequence by It was, we need a conjunction to link what we are going to mention with what we started the sentence with. Both that and when can be used as a conjunction, but each one has a different meaning:
that would give further information whereas when would mean at the time that.
By substituting the meaning of when in the sentence, you would see that that makes the most proper choice.