The Montenegro international has put pen to paper on a five-year contract and becomes the Hammers' fifth signing of the summer.
The 18-year-old, who became the second-youngest player in the history of Swedish league Allsvenskan in April 2015, made 70 appearances in Halmstad's first team.
"I'm really happy to be here, it's a dream come true," Haksabanovic told the club's official website. "West Ham is a big club and it is a nice feeling to have signed. The move happened quite fast - we heard that they wanted me, so I was interested to hear the plan for me and when I did I was very pleased.
"I am an attacking player, I like to dribble and shoot, but I work hard for the team. I am really looking forward to getting started, I have watched quite a few West Ham games in the Premier League and I can see that they have some great players and great fans. Now I just want to get used to being with the team and then hopefully play some games at some point next season."