The black and white one probably reads in as a logical array. imwrite() can write logical arrays to TIFF but not to JPEG. To write a logical array to JPEG use
ArrayGray = uint8(LogicalArray) .* uint8(255);
and then imwrite ArrayGray.
Note, though, that this would produce a grayscale JPEG image, which is fairly rare (I have only ever seen one that was not just a demonstration that creating them was possible.) Some systems might refuse to recognize grayscale JPEG images. You might need to do the conversion to Gray as I indicated and then use
ArrayRGB = ArrayGray(:,:,[1 1 1]);
and then imwrite ArrayRGB
