Where in legal parlance, e.g.:
where a defendant has committed a crime, he or she shall.....
Can it replace in cases where?
In general, legal language is very carefully written by professional lawyers, and should not be changed. The reason is that legal decisions are based on precedent, that is, they are based on how similar language was interpreted in the past. For example, if there was a lawsuit that was decided a certain way, and a lawyer wants to make sure that a lawsuit involving the contract he is writing now would be decided in a similar way, he might make the language in his contract sound like the language in the old contract, so that a judge will think of the two contracts as being more the same.
I think, "where a defendant has committed a crime...", "in cases where a defendant has committed a crime..." and "when a defendant has committed a crime..." could have slightly different meaning. Remember that a contract or other legal document can be argued about after it is written. If you write "where a defendant has committed a crime," I can say, "see, we are talking about a place where a crime was committed, and we are somewhere else, so what is written doesn't matter" Or if you write, "when a defendant has committed a crime," I can say "see, that does not apply, because this defendant's crime was committed a long time ago." I think that "in cases where" is more clear, because it is harder to argue out of in this way.
There are a lot of strange things in legal language that are written the way they are because they have always been written that way, and if someone changes them, he does not know how a judge will interpret the changes, so no one wants to change them.
So no, I would not change legal language. It is hard to read, but it is written the way it is on purpose.
But, if you are just talking or writing in normal English, not in a legal document of some kind, you can say "when a defendant has committed a crime..." and everyone will know what you mean.