Mullins' move comes just two days after his final appearance for the Hammers as a substitute in the 2-0 FA Cup win over Hartlepool.
Mullins told the club's website: "It was a little bit of a shock. I trained on Sunday with West Ham after the game on Saturday and then it all happened very quickly, but I'm very pleased to have joined.
"It was a great experience to have worked under Gianfranco Zola but it's a great challenge to come here and work with some really talented players.
"I enjoyed my time at West Ham but I was there for five years and thought that maybe it was time for a change.
"Portsmouth are a club with a lot of history. They won the FA Cup last year, so I'm very excited to be here."
Pompey chief Peter Storrie said: "Tony and I decided to move for Hayden on Saturday night. We got hold of West Ham on Sunday morning and I think they were a bit surprised that we wanted to get the deal done so quickly.
"Hayden's an experienced player who has played exceptionally well against us in the past. He's a guy with immense experience in the Premier League, and that's what we need in this situation.
"He wanted regular football, because he has been in and out of the West Ham side."