Why iPhone apps gets pushed to background after sometime? As we know iOS pushes apps to background after some time if you keep the phone idle.

I notices that this doesn't happen with the native apps like phone, messages and mail.

It comes really handy when you are opening the mail app and it opens quickly. but any third party app like Gmail app for iPhone doesn't behave this way. each time I open it, it takes 1 minute to open.

Push works perfectly though but opening the app takes lot of time.

Can anyone advice on how to prevent that? there must be some tweak by which we can prevent selected apps from being purged after inactivity and make them available all the time?
You can only prevent this on a jailbroken phone. Apple trusts its apps not to hog the battery and are OS-level apps so they can run in the background. All other apps from the AppStore are not first class citizens. When they go in the background, their state is saved and restored when they are opened again. This is to prevent them from constantly updating content and draining your battery.

Long story short, you can only get that sort of control when you jailbreak. Note: if you are not careful and run many programs in the background after jailbreaking, your battry life will be really poor.