Joachim Low's world champions went ahead through Mario Gomez's penalty after 13 minutes.
But Slovakia, who are in the same group as England and Wales in France, hit back through Marek Hamsik, Michal Duris and Juraj Kucka in Augsburg.
The game was played in heavy rain with concerns the match might be abandoned.
Germany, who are in the same group as Northern Ireland at Euro 2016, have to finalise their 23-man squad by midnight on Tuesday.
Elsewhere, Euro 2012 winners Spain continued their preparations for the defence of their title with a 3-1 win against Bosnia-Herzegovina in Switzerland.
Celta Vigo forward Nolito scored the opening two goals for Vicente del Bosque's side.
Chelsea midfielder Pedro added a late third after Emir Spahic, who was later sent off, had reduced the deficit for Bosnia.
Spain gave a debut at right-back for Arsenal's Hector Bellerin.
Southampton's Graziano Pelle scored the only goal as Italy beat Scotland 1-0 in Malta, while Portugal - who meet England at Wembley on Thursday - were 3-0 winners at home to Norway.
Germany suffered a third defeat in four games as they were beaten 3-1 by Slovakia in the final match before their Euro 2016 squad is finalised.