Mr Fountain said that he had been "experimenting" with the music when he was identified by a tabloid newspaper.
In a statement he said: "The lyrics that appeared online were influenced by a style of hip-hop that I was experimenting with at a private freestyle session and blurted out in a moment of madness.
"There is absolutely no excuse - I take complete responsibility for my actions - but they were in no way thought out or represent at all my attitude towards women, rape and violence.
"I just want to apologise from the bottom of my heart to everyone who I have offended or upset.
"I am also mortified to have put my mother, grandad and girlfriend through the last few days which they are hurt and bewildered by and so do not deserve. I am so sorry."
Mr Fountain added: "I have had two wonderful years playing Tommy Duckworth with only happy memories of my time on Coronation Street.
Mr Fountain's departure is the latest setback for the ITV soap which is currently missing two of its most familiar faces.
Bill Roache, 81, who has played Ken Barlow in the ITV1 soap since its launch in 1960, is absent from the show as he awaits trial for child sex charges.
The world's longest-serving soap actor, who will enter formal pleas in court next month, is due to face trial in January over two counts of raping a 15-year-old girl in east Lancashire in 1967 and five indecent assaults involving four girls aged between 11 or 12 and 16 in the Manchester area in 1965 and 1968.
Roache strenuously denies the allegations. Roache's lawyer said his client was looking forward to standing before a jury to "vigorously protest his innocence" over "deeply upsetting" child sex allegations.
- The Independent