To "rat on" (or sometimes, alternatively, to "rat out") means to snitch or to squeal on somebody. To tell someone in authority that you saw someone else doing something that was against the law.
Snitching has been associated with rats because rats are thought of as filthy scavengers generally found in sewers. Snitching on someone is the lowest of the low in criminal circles and prisons across the nation.
"Nobody likes a rat", is a phrase that is most often heard in movies or stories about organized crime families and such. There is no punishment other than death for a rat.