I was wondering if there is any general theorem, which guarantees the flatness of $\omega_{X/B}$ over $B$ for a flat morphism $f : X \to B$ of schemes of finite type over $\mathbb{C}$ with equidimensional fibers. I am specially interested in statements which apply to the case of nonreduced $B$. Here by $\omega_{X/B}$ I mean $h^{n}(f^! \mathcal{O}_B)$ where $n$ is the relative dimension of $f$ and $h^{n}$ means the cohomology of the complex at the $n$th position.
A sufficient condition is that $f:X \rightarrow B$ is flat and locally finite type map between locally noetherian schemes such that its fibers are local complete intersection morphism (see EGA IV$\_4$, 19.2 for relative lci maps), in which case $\omega_{X/B}$ is even a line bundle on $X$ whose formation commutes with any base change on $B$. This covers the case of flat families of semistable curves, for example, and this lci condition on fibers is open on the base. 


It sounds like you may want Exercise 9.7 in Hartshorne's "Residues and Duality". I paraphrase the statement: Exercise 9.7 (RD): Let $f: X \to B$ be a flat morphism of finite type of locally Noetherian preschemes. Then, $f^!(\mathcal{O}_B)$ has a unique nonzero cohomology sheaf, which is flat over $B$, iff all the fibers of $f$ are CohenMacaulay schemes of the right dimension. Moreover $f^!(\mathcal{O}_B)$ is isomorphic to (a shift of) an invertible sheaf (on $X$) iff all the fibers of $f$ are Gorenstein schemes of the right dimension. In particular, this addresses the case you mention in your comment ($f$ Gorenstein), since then $f^!(\mathcal{O}_Y)$ is locally free on $X$ and, since $f$ is flat, certainly flat over $B$. [Aside: I believe I learned this reference from Brian's book "Grothendieck Duality and Base Change", which I think also contains a proof of this.] 

