When you flatten an image in Photoshop it collapses all open, visible layers into one layer. This does not decrease the image quality. If you do not flatten your work, you will end up with a PSD (Photoshop Document) that has a very large file size, and can only be saved as a PSD file. After you have flattened the image, Photoshop will then give you the choice of many different file types under which you can save the image.
Layer -> Flatten Image
From the Layers Palette