iOS 4 has just been released by Apple for iPhone 4, iPhone 3GS/3G and iPod Touch. All iOS 4 features are not compatible with all the devices, like Multitasking feature is available only with iPhone 4 and iPhone 3GS.
To update your iPhone OS devices to latest iOS 4 simply connect your device to your computer through USB and open the iTunes. You will see a message as shown in the screenshot below.
Simply click on the “Download and install” button to get your device to the latest iOS 4.
Direct Official Download Links for iOS 4: