Mr Bolsonaro, 66, had been suffering persistent hiccups for 10 days.
There have been concerns about the far-right leader's health since he was stabbed in the intestines while campaigning in 2018.
Mr Bolsonaro was seriously wounded in the attack and lost 40% of his blood. He has had several operations since.
After treatment for an obstruction to the intestine, which did not need surgery, he promised to be back at his office on Monday morning.
"Only God can remove me from that chair," Mr Bolsonaro said upon leaving hospital, in reference to the presidency.
"I wanted to leave from day one, but they didn't let me. I hope in 10 days I'll be eating barbecued ribs, eating anything," he added.
More about: