In Maryland, the filing fee is about $215, depending on the county you're filing in. Most lawyers include this fee in their initial retainer ? the first deposit of money you make toward your divorce so lawyers can start working. So, don't worry that you might end up paying for filing twice.
If you do not pay the fee as required, your case will be considered to have been withdrawn and no further action will be taken by the court.
In order to ask for IFP status, you must file a "PETITION AND AFFIDAVIT TO PROCEED IN FORMA PAUPERIS" with the Court, in which you give the Judge detailed information about your financial situation. The required form is attached to these instructions, along with a form order for the Judge.
Rule 1-325 - Waiver of Costs Due to Indigence-Generally (a) Scope. This Rule applies only to (1) original civil actions in a circuit court or the District Court and (2) requests for relief that are civil in nature filed in a criminal action.