The 27-year-old seam bowler was recently released by Derbyshire after his contract there was terminated by mutual consent.
Carter moved to Derbyshire from Nottinghamshire on a two-year deal last September and took 20 wickets in 16 appearances across all formats.
He took 3-34 against Northants in the NatWest T20 Blast in May.
Carter joins a Hampshire side bottom of the table with just 86 points from 10 matches.
Andy Carter has joined County Championship Division One strugglers Hampshire until the end of the season.