The 21-year-old goes straight into the squad for the League One trip to Crewe on Saturday.
He becomes the second loan signing of the day for U's boss Joe Dunne, who added Charlton goalkeeper John Sullivan to his squad.
Dunne told the club's official website: "Josh is a player who I've known since he was at Stockport, and he has wonderful potential as a centre-back.
"As I said with John Sullivan's signing earlier in the day, it's crucial we have competition for places in order that we can bring out the best in the players we have at the club."
Thompson joined Pompey in the summer from Celtic and has made three appearances for the Fratton Park outfit.