If you are saying that you have purchased OS X 10.7 Lion or OS X 10.8 Mountain Lion via the Mac App Store, you should be able to redownload it directly from the store:
View and reinstall purchased apps
- To view a list of all purchased apps, click Purchases in the toolbar.
- To install an app, click the Install button for the app in the Purchases list.
- To hide a purchased app in the Purchases list, hold down the Control key, click the app you want to hide, and then choose Hide Purchase.
- To view hidden apps, choose Store > View My Account, enter your Apple ID and password, click View Account, and then click View Hidden Purchases. To show a hidden app in the purchased apps list, click its Unhide button.
If you are unable to locate the purchase, it may be hidden:
If you are talking about iOS (the operating system used on the iPhone, iPad, and iPod Touch), this software is downloaded directly from the iTunes application on your computer when updating a device.