It is key to remember the purpose of the assessment. I presume this is an end-of-course summative assessment. You are therefore trying to find out to what extent they have learned the material you have taught which may be required for further study or employment. You don't want them to study all of mathematics, you want them to study the specific topics that you have taught, and become proficient at the achievement objectives of the course. If old exams were valid, ie. they covered the achievement objectives, studying the old exams will further that aim.
In contrast, a formative assessment, which you could use to guide your teaching, could validly assess the general mathematical competence of your students. However this should be done near the beginning of the course, not the end. It is not the test that shows up on their report. These are two quite different purposes.
If you want to widen the breadth of topics that will be assessed in a summative assessment, it is best to specifically alert the students to such changes and possibly even give some example questions so that students can give the new topics adequate weighting in their revision. This will be more effective than hiding the previous exams and telling them to study for everything.
As you noted, beyond encouraging study towards the achievement objectives, it can also reduce presentation confusion and exam stress which are both confounding factors for a valid assessment.
As a side note, whether you publish or not, some students will manage to get hold of old exams, which gives them an advantage unrelated to their mathematical ability. Publishing is the only way to level the playing field.