imwrite(YourImage, 'YourFile.jpg', 'mode', 'lossless')
This will use the seldom-used JPEG lossless compression.
I would advise that unless you have a strict requirement to use JPEG that instead you use one of the lossless image formats such as PNG or TIFF. When you use JPEG, it is all too likely that at some point someone (you) will forget (or not know) that it is important that the pixels remain unchanged when read back in.
Note: if you are trying to do watermarking or steganography, then you should pretty much assume that the image will be converted to lossy JPEG at some point, and you need the information to survive even so. One of the several ways to handle that is to do your own DCT, embed the information in the DCT coefficients, and do an inverse DCT and imwrite() that. Then when the JPEG library does its DCT, the result it is going to end up with will be the result that holds the embedded information. For recovery afterwards, DCT the loaded image and extract the bits.