Sure she can. People snub each other in politics all the time (even when they're joined at the hip). It's called "setting boundaries", and letting people know they can only count on so many indulgences from you. In fact, it is precisely through their willingness to take a stand (even at the cost of temporarily upsetting their allies or coalition partners) that stronger politicians distinguish themselves.
But even if she didn't want to offend his sensibilities -- there are bigger issues at play, such as the fact that Erdoğan is not only acting like a bully in this case (as he normally does at home), but is expecting the German government to do his dirty work for him. And hence, tacitly, to take "his" side in the Great War of Values on openness, and freedom of expression.
That's why Merkel got it wrong. What she needs to do is both act to abolish the law and exercise her discretion in declining to prosecute this case.