Yes, you can, but there are some important things to keep in mind.
First off, I'll note that I'm not a lawyer or intellectual property expert. This is just my opinion, as informed as I can make it.
To my knowledge there's no prohibition in the App Store rules about what you do with your source code. The main issue arises when there's a conflict between the licence of the source code (i.e. the GPL) and the App Store. This was the problem with the VLC app that Ian C referenced in the comments, particularly with regards to other open source libraries used in an app.
Another issue is when not all the code belongs to you - i.e. others have contributed and hold copyright on parts of the code. You can't submit something to the App Store that you don't have the rights to, so everyone who owns the code in the project must agree.
That said, if we're talking about a program that you've developed entirely on your own, without code from other projects or people, then you're free to do with it whatever you feel like - you can release it on the App Store, licence it under anything you want (the licence applies to what others do with it, not you).
There are some open sourced apps on the app store, you can find a partial listing here