They face 18 months of detention while money-laundering charges are prepared.
The accusations stem from Brazil's expansive anti-corruption probe, known as Operation Car Wash.
The couple, who co-founded the left-wing Peruvian Nationalist Party, have denied the charges.
Mr Humala tweeted: "This [detention] confirms an abuse of power, which we will face in defence of our rights and the rights of all."
Peru's prosecutor's office made the request on Tuesday, and a judge ruled in its favour on Thursday.
The couple have been under investigation for three years for allegedly accepting money from Brazilian construction company Odebrecht to bankroll Mr Humala's election campaigns.
He is also accused of taking money from late Venezuelan President Hugo Chavéz.
Prosecutor Germán Juaréz accused Mr Humala of "morally wounding society" by running on a campaign that used "illicit money".
The prosecution also said it feared the pair would flee the country unless they were jailed.
Earlier this year, the same judge, Richard Concepción, ordered the pre-trial detention of another of Peru's former presidents, Alejandro Toledo, over bribery allegations, but he refused to turn himself in. He is now believed to be in the United States.
Mr Humala ruled Peru from 2011 to 2016.
He was an ally of former Brazilian President Luiz Inacio Lula da Silva, who this week was sentenced to nine and a half years in prison for corruption, also resulting from Operation Car Wash.
The Brazilian investigations have unearthed what is dubbed as the biggest national corruption scandal of all time, leading to allegations against many of the continent's most famous politicians.
Former presidents Ricardo Martinelli, from Panama, and Mauricio Funes, from El Salvador, are among those who have also been accused of benefiting from bribes.
Brazil's current president, Michel Temer, is currently waiting to hear if a bribery case against him will get to the country's Supreme Court.
The former president of Peru, Ollanta Humala, and his wife, Nadine Heredia, have turned themselves in after a judge ordered that they be placed in pre-trial detention.