Becomes Sam Tarly Maester

Why is Samwell Tarly allowed to be a maester after joining the Night's Watch?

Like everywhere else in Westeros, the Night Watch needs a maester. The position is important for a number of reasons: you are a scholar (so you know history) and you are a healer (so you know medicine). These are things the Night Watch must have.

The night watch had a maester before Sam: Maester Aemon was the Maester of the Night's Watch until his death. So it seems natural that a member of the Night Watch can become a maester.

Sam didn't leave the night watch any more than the rangers "desert" when they are traveling in the north, or the brother's "desert" when they are making recruiting trips in the south. Sam goes to Oldtown to become a maester and return to the night watch .

Since the maesters are (theoretically) politically neutral, Sam's vows to the citadel shouldn't conflict with his vows to the guard when he returns. In fact, both the Maester Order and the Night Watch essentially swear the same Vow: You sever all family ties, cannot inherit land, marry or father children, and vow to serve "the kingdom" regardless of who is in power. So your vows go very well together, probably more so than anywhere else in Westeros.

Panther

Maestor Aemon was first a Maestor, then he joined the Night Watch

KutuluMike

Everyone else who joined the Night's Watch gave up their previous lives ... except for the maester. That should tell you something.

Flater

@KutuluMike: Maester Aemon has also given up much of his previous life, although it can be argued that hiding from reprisals was more because he was a Targaryen. Independently of, Why when he joined the guard, Aemon gave up his identity (Targaryen) while maintaining his skills (maestering). This is not too different from a crow that keeps its swordsmanship even though it has given up its personal life (family name, inheritance, ...). But because Maester alraedy by nature give up their name (they're tied to a castle, not a bloodline), it makes the evolution from Maester to Crow "easier".