The 21-year-old, who can also play in midfield, scored twice in 33 games after joining Posh from Hartlepool for £500,000 in September 2014.
But he did not figure last season and spent the first half of the campaign with Bradford City, before returning to Pools on loan in February.
James has signed with an option to make the move permanent next May.
He is Darrell Clarke's third new signing of the summer for Rovers, who have won promotion in the last two seasons, following Plymouth Argyle central defender Peter Hartley and Port Vale winger Byron Moore.
"He's only 21 but already has the benefit of over 150 league games behind him," said Clarke. "They sold him to Peterborough for a £500,000 fee and he has since been out on loan at Bradford City and back at Hartlepool.
"I thought he was Pools' best player when they came to The Mem last season. I've watched him on a number of occasions in the last few years. He's always impressed me with his work rate and I believe I can get him scoring goals."
Find all the latest football transfers on our dedicated page.
Bristol Rovers have signed forward Luke James on a season-long loan from fellow League One side Peterborough United.