What did they wear before they started to prepare the cake? This is correct grammar. However, 'wear' is not a suitable word here. Say What did they put on before they started to prepare the cake?
Answer: They were an apron. The past tense of 'wear' is 'wore', not 'were'. However, say 'put on'. 'They' is plural, so it's better to use