Her relatives contacted authorities after she disappeared from her parent's home on Sunday, the minister added.
In February, local media reported that a South African had joined IS in Syria, and was trying to recruit other South Africans via social media.
It was the first reported case of a South African joining the group.
The 15-year-old had been taken off a British Airways flight, and had been "returned safely to her parents who are very happy" that her attempt to join IS had been thwarted, State Security Minister David Mahlobo told South Africa's privately owned eNCA news channel.
Social workers would help her overcome the "damage" caused to her by IS propaganda, he added.
"The girl over the past period has been actually using technology, the social platforms, interacting with strange people and reading some material that suggested that she is actually getting an interest to join the terror group," Mr Mahlobo said.
US officials believe that more than 20,000 people from more than 100 countries have gone to Syria and Iraq, where IS has declared a caliphate.
British officials have said that this includes at least 600 people from the UK.
IS has established a presence in Africa, with militant groups in Nigeria and Libya pledging allegiance to it and carrying out bombing campaigns in its name.
In February, South Africa's Daily Maverick newspaper reported that a South African, who called himself Abu Hurayra al-Afriki [The African], had travelled to Syria to join IS.
He had set up now-suspended Tumblr and Twitter accounts to advise would-be jihadists on how to do the same.
A South African girl has been taken off a plane in Cape Town on suspicion of planning to join Islamic State (IS) militants, a minister has said.