The deal 2.1 billion US dollar deal was to provide trains to bring coal to the coast for export.
The contract is on a "take or pay" basis, which means that Transnet commits to providing the trains and the company is obliged to pay whether they move product or not.
Transnet said BHP was the first major customer to commit to a long-term take-or-pay contract with it and it hoped to formalise similar agreements with 28 remaining customers by the end of November.
"The deal will be adding close to 10 million tonnes in capacity on the line from the current 73 million tonnes over the next seven years," Transnet, which has battled to boost its ability to move coal, said in a statement.
"The agreement with BHP is a massive boost for certainty around Transnet's capacity expansion programmed on the export coal line," it said.
Jon Evans, BHP's energy coal South Africa asset president, told a news briefing that the company's demerger plans would have no impact on the deal.
In August, BHP said it would spin off some aluminium, coal, manganese, nickel and silver assets worth an estimated 16 billion US dollars into a new company headquartered in Perth and listed in Australia, with a secondary listing in Johannesburg.
South Africa is a major producer and exporter of coal, which gets shipped through its Richards Bay Coal Terminal (RBCT) to Asian and European markets.