Stacey, 21, provoked revulsion with comments made while the Bolton Wanderers star still lay on the pitch.
The 23-year-old midfielder was left fighting for his life after suffering a heart attack during an FA Cup tie on March 17.
Horrified fans watched live on TV as he fell to the ground during the quarter-final clash at Tottenham Hotspur.
Police were inundated with complaints as members of the public reported the student's comments.
Stacey, a Swansea University biology undergraduate, was quickly tracked down and arrested.
Bolton face emotional return to Tottenham
26 Mar 2012
Fanzine defends Muamba 'grief junkies' cover
Muamba watches Bolton win on TV
Last week he admitted inciting racial hatred when he appeared briefly at Swansea Magistrates' Court and today he was jailed for 56 days at the same court.
The first of Stacey's messages began with ''LOL (laugh out loud). **** Muamba. He's dead!!!''
A number of people took him to task for his views and he responded with a further string of offensive comments aimed at other Twitter users.
Stacey was close to tears during his appearance before magistrates last week.
Muamba's recovery since suffering a cardiac arrest 10 days ago has been described as ''miraculous''.
He remains in intensive care in hospital where his condition is described as serious but stable.
Stacey broke down as he was taken away in handcuffs to a holding cell beneath Swansea Magistrates' Court.
He was led past the public gallery, where he was briefly embraced by friends and his parents as he shook with emotion.
Moments earlier, District Judge John Charles told him: "In my view there is no alternative to an immediate prison sentence."
He said that when Muamba collapsed, "it was not the football world who was praying for him... everybody was praying for his life".
He added that abusive remarks made to Stacey "via a social networking site were instigated as a result of vile and abhorrent comments made as a result of a young man who was fighting for his life".