Swansea University student Liam Stacey, 21, from Pontypridd, was sentenced to 56 days on Tuesday.
He said the Swansea University biology student had admitted an offence of racist intent.
Stacey was sentenced at Swansea Magistrates' Court on Tuesday after admitting inciting racial hatred over remarks about the Bolton Wanderers player, who collapsed during a cup tie against Tottenham Hotspur.
Muamba, 23, who suffered a cardiac arrest, has been in hospital since the match on 17 March.
Mr Justice Wyn Williams told Stacey: "There can be no avoiding the conclusion that your offence was committed in the context of a grave illness that had afflicted Fabrice Muamba.
"It was immediately apparent that he was gravely ill and while he was lying prostrate on the pitch you posted comments that were extremely racist couched in terms that can only be described as extremely offensive.
'Behaviour'
"What was written was capable of being read by any user of Twitter and these messages provoked a very strong response.
"You received responses which were extremely critical but you did not desist - instead you posted eight messages which were extremely abusive and insulting.
"You later realised the enormity of your behaviour and tried to apologise.
"But you deserve to be punished for your actions. It can't be argued that a term of 56 days is too long for this offence.
"By pleading guilty you admitted a racist intent to your comments."
Stacey was arrested after his comments on the social networking site were reported by other users.
A number of people challenged Stacey on Twitter following his first comment, and he responded with a number of offensive posts aimed at other Twitter users.
'Stigma'
Last week the court heard how Stacey posted the offensive comments shortly after the former England Under-21 star collapsed during the FA Cup quarter-final at White Hart Lane.
That's not worthy of a 56 day sentence. That's not even worthy of a stern talking to by the police. Going to jail for saying stuff on twitter is something the Syrian government would do. Your country should be ashamed.