No, Carl was not raped. Not on the show or in the comicbookcomic book.
From Zap 2 It interviewarticle about the TV episode:
"That scene has always been a really difficult one," Kirkman tells TVLine. "When I was writing the original comics, in the panel description for artist Charlie Adlard I [wrote], 'Carl is on his back, and the guy is pulling his paints off -- but don't worry Charlie, he's not going to get raped!' I actually included that in the panel description because it is such a heavy and dark scene, and I didn't want Charlie to be freaking out while he was trying to draw that.
From Issue 58 of The Walking Dead, in the previously box (the attempted rape was issue 57)
After a man tried to rape Carl, Rick brutally murdered him in front of Carl's eyes.
(Italics mine for emphasis.)
The site ComicBook.com has a comparison of the comic and show for the scene here.