The UK Government will allocate up to $70.41m (£52m) for the new ports.
Potential bidders for the development will have to make a pledge to attain net-zero by 2045.
The bidding process will be launched in spring, following which the bids will be evaluated and successful sites declared.
The new locations are expected to become operational by next spring.
UK Prime Minister Boris Johnson said: “Freeports will help to accelerate our plan to level up communities across the whole of the UK.
“They have the power to be truly transformational by creating jobs and investment opportunities to enable people to reach their potential, and I am delighted that people across Scotland will reap the benefits that will come from having two new green freeports.”
This deal will support the UK Government’s long-term plan to provide opportunity more equitably across the entire UK, in line with the Levelling Up White Paper.
The prospective bids will be evaluated by officials from the UK and Scottish Governments, ensuring that the bidders share their goals.
The bid will be open for any sea, air or rail port as part of a consortium with other businesses, the council and other relevant public bodies.
However, the participating consortium will have to provide benefits to local communities and work towards the net-zero goal while developing the ports.
Last March, the UK Department for Transport launched a $27.53m (£20m) competition aimed at encouraging innovation in the shipping industry.