The 28-year-old former Clyde and Dundee centre-half will link up with Stephen Robinson's squad when his current contract with Livi expires.
Gallagher was a key player for the West Lothian club as they earned promotion last season and comfortably retained their Premiership status this time round.