It isn't necessary, but many physicists have to analyze huge amounts of data out of necessity. Telescopes and particle accelerators generate petabytes of data. So they have a lot of practice with this sort of thing. Physicists also have to be ridiculously good at math and particularly statistics, again out of necessity.
Again, physics isn't really a prerequisite. It is just that many physicists have the relevant experience already to be a good data scientist.