The scandal over the conduct of UK politicians claimed its first Holyrood scalp when Mr McDonald released a statement admitting his behaviour may have made others uncomfortable.
Mr McDonald,37, said he would remain as Aberdeen Donside MSP which he has served since the 2011 Scottish election.
Formerly regarded as one of the SNP’s rising stars, Mr McDonald issued an unreserved apology to those he may have upset.
His statement said: “It has been brought to my attention that some of my previous actions have been considered to be inappropriate – where I have believed myself to have been merely humorous or attempting to be friendly, my behaviour might have made others uncomfortable or led them to question my intentions.
“My behaviour is entirely my responsibility and I apologise unreservedly to anyone I have upset or who might have found my behaviour inappropriate.
“In light of my position in government, I believe it would not be appropriate for me to continue to serve in my role in the Scottish Government at this time and I have tendered my resignation as a minister.
“I hope that in taking this step neither any particular woman or my family will be the focus of undue and unwarranted scrutiny.
“It has been an honour to serve in the Scottish Government and I will continue to serve my constituents in Aberdeen Donside to the best of my ability.”
The SNP had confirmed it was investigating two complaints of inappropriate behaviour. It is understood the other complaint does not relate to a parliamentarian.
Earlier this week First Minister Nicola Sturgeon and Deputy First Minister John Swinney both warned men - including those in the SNP - to reflect on their behaviour as allegations of sexual harassment reached Holyrood.
Ms Sturgeon previously said the allegations were a “line-in-the-sand moment where all of us can say, firstly and foremostly, to men that indulge in this kind of behaviour, that it’s not acceptable”.
A spokesman for the First Minister said: “Mark has taken the right action in apologising and recognising that in his current role it would be inappropriate for him to remain in government.
“He will continue to make a valuable contribution to parliament as the MSP for Aberdeen Donside. As the Deputy First Minister told parliament earlier in the week it is right that men take responsibility for their behaviour and it is to Mark’s credit that he has done so.”
A confidential phone line has been launched and an anonymised survey is to be carried out to determine the extent of the problem at the Scottish Parliament, which said it had no current cases.
The measure was announced after Presiding Officer Ken Macintosh held an urgent meeting with representatives from each party including Ms Sturgeon.
A Scottish Parliament spokesman said cases of inappropriate behaviour or harassment brought to the attention of officials over the last five years were ‘’in single figures’’ and one historic case had been referred to police.
The Government confirmed the number it has dealt with is similar and it is reviewing sexual harassment complaint procedures, as are the parliament and all political parties.
The claims of harassment in Scottish politics first emerged after human rights lawyer Aamer Anwar said women ranging from MSPs to interns had raised concerns about behaviour across the Scottish Parliament.
A Government spokesman said: “Mark McDonald MSP has left the Scottish Government.
“Mr McDonald tendered his resignation to the First Minister on Saturday.
“The Education Secretary is responsible for all aspects of the education portfolio including those led by the minister for childcare and early years. The First Minister will appoint a new minister in due course.”