Much of modern science involves code these days, in large part due to the amount of data available - it would be almost impossible to analyse without computational assistance.
One of the basic prerequisites for any published scientific results is that it be reviewed by peers, to ensure the research and conclusions are valid.
We may try pretty hard to write software without bugs, but they definitely still happen - and errors can be hard to spot. The bug doesn’t have to cause catastrophic and obvious failure - it could be silent but sneaky.
If software is required to perform science, it stands to reason that errors in your software mean errors in your science.
Scientific code needs to be peer reviewed, and ideally open source.That’s easier said than done. Getting there requires awareness, culture shift, and adherence to best practices.