Practice, practice, practice!! That is the only way to learn them. Also, make sure you know your circle of 5ths, that will help tremendously.
Also one last thing you should do is make sure you arent thinking enharmonically. If the scale is say, Ab major, dont try and play it in sharps, think of it in in flats (try that one in sharps actually, you'll only have 9 sharps!!)