Hi Niwantha,
The use of "an" is governed by the starting sound of the next word. If the next word begins with a vowel sound, "an" is needed.
We cannot depend solely on the presence of vowel letters to decide if "an" is needed, because some words start with vowel sounds though they do not start with vowel letters.
Examples:
An hour /ˈaʊər/. The word starts with a diphthong vowel /aʊ/ ("hour" starts with "h", yet we do not say "a hour").
A hotel /hoʊˈtɛl/. The word start with a consonant /h/ (therefore, "an" is not used here).
A European /yʊərəˈpiːən/. Though the word starts with a vowel letter "E", it starts with a consonant sound /y/ (therefore, "an" is not used here).
I hope you can see that the golden rule is to consider the starting sound of the word. For "equal", it starts with a vowel /iː/ sound, so your first sentence is correct.
*You may wish to take a look at some IPA phonetic vowel symbols using this website: http://cmed.faculty.ku.edu/ipafolder/vowels.html. You can then check the IPA symbols of different words using a dictionary and see if the pronunciation starts with a vowel.
On a separate note, "equal opportunity" both describe "legislation", so you need to hyphenate them to form a compound adjective (equal-opportunity legislation).