The 28-year-old, who has 75 international caps, was out of contract after being released by French giants Toulon.
However, he returns to play rugby in his native country on a deal partly funded by the Welsh Rugby Union (WRU).
Halfpenny told reporters: "I'm delighted to be coming back to play in Wales.
"I would like to thank the Scarlets and the WRU for giving me the opportunity to sign a national dual contract (NDC) and can't wait to get started."
Wales head coach Warren Gatland added: "It is great news for Welsh rugby that Leigh Halfpenny is returning to play his rugby in Wales.
"The NDC system helps us to bring these players back and I look forward to seeing him play for the Scarlets."
Halfpenny's deal at Scarlets, who won the Pro12 last season, is likely to see 60% of his salary paid by the WRU.