The 23-year-old had been close to joining Dundee United earlier this week but hesitated over the move and Terrors boss Craig Levein dropped his interest, despite admitting he was the club's main target.
Porter was attracting interest from other clubs, but because of his age, any move within England would have involved a compensation fee.
He would have to wait until turning 24 before moving for free within England, but transfer regulations allow him to make a no-fee move to Scotland.
The striker hit 22 goals in Coca-Cola League One last season and Oldham had expressed dismay after learning of the loophole, which was also exploited by United's Clydesdale Bank Premier League rivals Hibernian earlier this summer.
Oldham managing director Simon Corney urged Porter, whose contract expires at the end of June, to show loyalty to the Latics.
He joined Oldham from Bury in 2005, with the fee set at £150,000 by a tribunal.