Is this German sentence correct?
"Hast du deinen militärdienst beendet?"
I intended to say- "Have you finished your military service?"
Did I say this sentence correctly in German?
Yes, I think your sentence is correct. However, you should bear in mind that in German, nouns are written with a capital letter:
Hast du deinen Militärdienst beendet?
As far as I know, the more common term in Germany is "Wehrdienst":
Hast du deinen Wehrdienst beendet?
Edit: Thinking about it a little more, there are two more aspects to consider:
1) "Beenden" often means ending something before its intended end. So if you really mean "finish", "complete", then the better verb would be "leisten":
Hast du deinen Wehrdienst geleistet?
2) Your sentence is in the informal "du"-form. In a formal version, this would be:
Haben Sie Ihren Wehrdienst geleistet?