How to install an app on iPhone from a second machine?
For most users, the headache free method is preserving the iTunes folder in its entirety and bringing it over to the other computer. You would then sign into the account you obtain the app with on that computer, and authorize it.

If you're simply without the first computer and want to get the app back, then you would simply re-download from the App Store for free (assuming it hasn't been removed).