Because for one reason or another Tywin Lannister was "annoyed" and offered him a choice... take the black or die...
[Jeor Mormont] Ser Alliser is an anointed knight, one of the few to take the black since I have been Lord Commander. He fought bravely at King's Landing.
[Jaremy Rykker] On the wrong side. I ought to know, I was there on the battlements beside him. Tywin Lannister gave us a splendid choice. Take the black, or see our heads on spikes before evenfall. No offense intended, Tyrion.
[Tyrion Lannister] None taken, Ser Jaremy. My father is very fond of spiked heads, especially those of people who have annoyed him in some fashion. And a face as noble as yours, well, no doubt he saw you decorating the city wall above the King's Gate. I think you would have looked very striking up there.
A Game of Thrones, Chapter 21, Tyrion III