To test a program for iPhone or iPad, seems like the only way is to join the Apple Developer program and pay $99 per year? Can you also jailbreak the iPhone or iPad and be able to test it?
You can use a jailbreaked iOS device for testing, but you won't be able to sell your App on the Appstore. And you won't be able to test the app on other (non-jailbreaked) devices. To do that you'll need the developer license.
The reason why this is so, is that every app needs to be signed (with the certificate you get from Apple when joining the developer program) to be run on iOS devices. Non-signed code will run on a jailbroken device, but not on any other device. Also a non-signed app cannot be sold in the Appstore.
Why all the talk about jailbreaking?
The iOS developers I know use ad-hoc distribution for testing. It's like when you sign your own SSL certificate on a home server. You'll have to add your own signature to the list of allowed signers on your device (butchering the terminology here, sorry), and then you can test to your heart's content.
Google turned up this: