I guess you can do it in the following way(it's only a sample):
1) a4j:commanButton executes some action and reRenders a content of the modalPanel.
2) in oncomplete event of a4j:commanButton you add code which shows modalPanel
Thus the modalPanel will not be shown until ajax call is finished.
Thanks a lot it works well