The man posted a sickening picture of himself holding a baby out of a window in what appeared to be a high-rise building with the caption: "1,000 likes or I will drop him."
After social media users demanded his arrest for child abuse, he was arrested on Sunday and charged with endangering the baby's safety.
News site Al Arabiya reported that the child was dangled out of the 15th-floor window of an apartment block in the capital, Algiers.
The man, who is a relative of the child, denied he put his life at risk, saying the image had been altered by social media users, Algeria's privately owned Ennahar TV reported.
"The picture was taken in a balcony with protective barriers. These were removed," he was quoted as saying.
The child's father pleaded with the court to forgive the man, saying he had just been playing a game.
However, the judge ruled against him, saying the picture was clear and the child's life was in danger.