PhD programs are looking for applicants with strong research potential. For top research departments, a successful research experience can help your chances significantly, but it’s not required.
Ultimately, the faculty are looking for evidence that you are excited to work on hard problems and can take initiative in solving them. You can demonstrate this in many ways – leadership in clubs, course projects, personal projects, job performance in industry, etc.. Many departments evaluate candidates in a nuanced way and will consider your achievements in the context of your background.
Prior research experience is typically not that important for admission to MS programs. For those who lack undergraduate or industry research experience, pursuing research as a master’s student can be a valuable stepping stone for applying to PhD programs.