Because for one reason or another Tywin Lannister 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.
A Game of Thrones, Chapter 21, Tyrion III