The Trump administration made a specific change to enforcement to enact this separation. As far as I can tell (not a lawyer but I've read opinions by those who are), it's perfectly legal because the actual laws don't say exactly how illegal immigrants should be detained. By the same token, when President Trump says the Democrats or Congress created laws that are causing this situation, that's a lie. There's discretion for the administration to go either way on this, and they're using it.
One argument being put forward is that this is a necessary policy to slow illegal immigration, but that's false. We've managed to deal with illegal immigration for decades without taking this particular step, and the illegal population has been stable or declining since before President Obama took office in 2009. It's not necessary to cause the kind of harm that is being done to these families if your goal is to reduce illegal immigration, as we've been doing for years. On the other hand, if your goal is to break up families for political purposes, then the policy makes sense.
This is not new. The administration tried the same thing six months ago. Back then Trump was threatening to remove protections for DACA recipients, and demanding more or less the same things in order to keep those young people safe from deportation. There was enough push-back that Trump didn't get what he wanted then, and so the administration decided to try again with a different kind of incendiary action.
I know people who don't think this is a bad thing. "People who can't obey the laws and enter the country legally deserve whatever treatment they get." "We need to make the results of illegal immigration harsh enough to make people stop coming." I understand those arguments, and even sympathize to some extent.
But...you need to draw a line somewhere. If there's no line, we'd just kill everyone trying to enter the country, and pretty much everyone agrees that would be morally reprehensible. The impact on these kids from this experience is going to last for years, and it's completely avoidable. Using those kids' pain to advance a political agenda is well on the wrong side of the moral line, and it needs to stop.
The President can stop this inhumane and unnecessary policy of family separation any time he likes. Don't believe it when he or anyone else tells you otherwise. Make your voice heard on this issue however you can, whether that be through posts like this one, calls to your representatives, protests, or whatever else works for you. And consider making your voice heard where it matters most...when you next vote.
Update June 21: So the President has indeed done what many have been calling for and stopped the family separations at the border. (Despite his repeated claims that Congress had to do it.) This doesn't fix the damage already done, but at least it's a step in the right direction.