You can simply use Chemdraw ultra or suitable module and optimize the ligands using steepest or conjugate gradient. If you want to optimize the structure with basis functional (Quantum mechanics based) some free software are available. But such optimization is little tricky. I suggest you to go with Chemdraw. See also Whatif server for refining the protein. Prodrg server also gives you energy minimized structures of ligands. If you are using Autodock or similar tools I think no need to optimize the structure of ligand as such tools generates best conformers based on the few scoring functions.
I agree with Leandro. In every docking simulations optimum geometry is obviously crucial. With which tool we carry out geometry optimization and at level, can affect our docking results. Argus and UCSF Chimera are good tools. I havn't used MOPAC software but many recommends it.
Setting correct protonation states of the Ligand groups as well as protonation states of the residues in the binding sire are crucial. you can find an extensive discussion about these issues at the:
One of the free software packages that can be used for Ligand preparation is Avocado, it also includes setting protonation states to reflect the pH of the environment.
If your ligands are commercially available compounds, then you may download the respective ligands from the UCSF ZINC database. These are pre-optimised for docking and virtual screening.
Use simply Chemsketch software. in that 3d optimization is there which will use the small molecule crystal information to establish the molecule in a proper way.