According to Paw Nation, hamsters squeak to express emotion. This emotion can be excitement, surprise, fear, distress or anxiety. A hamster can squeak briefly to express interest in a new toy or treat, or it can squeak persistently when afraid. Hamsters also squeak during territory disputes with other hamsters.
If a hamster squeaks persistently without a clear reason for the behavior, the hamster could be in pain or feeling ill. Take the hamster to the veterinarian right away if it shows signs of abnormal behavior, such as unusual vocalization, hunched posture, dull eyes, lethargy or a lack of interest in food.