Catalysis of the reactions: (E)-4-(trimethylammonio)but-2-enoyl-CoA + L-carnitine = (E)-4-(trimethylammonio)but-2-enoate + L-carnitinyl-CoA and 4-trimethylammoniobutanoyl-CoA + L-carnitine = 4-trimethylammoniobutanoate + L-carnitinyl-CoA.
L-carnitine dehydratase activity