Honore Kahi offered to take the baby as he was crying and preventing the mother from sitting in class.
He said his students were surprised, began to laugh and then took pictures.
He told the BBC that they then realised that "this is a good father, this is a real man... [and] a role model".
Some of those sharing the photograph on social media praised him as a hero.
Africa Live: More on this and other news stories
Mr Kahi, who teaches communications at Ivory Coast's Bouake University, said that women should not be discouraged by people's perceptions of what they should be able to do.
Girls are less likely than boys to start primary education in sub-Saharan Africa and are under-represented at higher education, the UN says.
"What prevails here is... male chauvinism," he said and then quoted an ancient philosopher in his interview with BBC Afrique.
"'It is not because things are difficult that we do not dare. It is because we do not dare that they are difficult.' In our environment we let ourselves be discouraged by others."
He said that when he took the baby and tied him on his back he stopped crying and fell asleep.
He knew how to do it by observing how women carry their children.
"In fact, men are able to do certain things, and usually it's the way society sees men that prevents them from doing these things."
An Ivory Coast professor, who was photographed carrying a student's baby in class in a widely shared image, has said being a mother should not stop women getting an education.