If you drop to, then the embedded clause is interpreted as though it's (grammatically) a direct quote containing an imperative. This can be punctuated in a number of ways:
The first lesson I learnt as a soldier was, "never underestimate the enemy".
The first lesson I learnt as a soldier was "never underestimate the enemy".
The first lesson I learnt as a soldier was: never underestimate the enemy.
The first lesson I learnt as a soldier was, never underestimate the enemy.
The first lesson I learnt as a soldier was never underestimate the enemy.
Just because it's grammatically similar to a direct quote doesn't mean that it is a direct quote, though, and there's no grammatical requirement that you mark it with quotation marks. (In fact, since it's not a direct quote, you might intentionally decide not to use quotation marks to avoid giving that impression.)
You can find approximately a zillion examples of this construction online. There's a tendency to separate the complement with punctuation of some sort (as in the first four examples above), but it's far from universal, so I don't think you don't need to add any punctuation. I found a number of examples in the Corpus of Contemporary American English (COCA), many of which don't have any such punctuation:
- And the lesson is never fight the United States without a nuclear weapon.
- The lesson is never talk for the sake of talking and never accept a bad deal for the sake of making a deal.
- The lesson learned here is never leave a child of any age alone in a car, for any length of time -- especially with the keys.
- "The biggest lesson is you just never quit," Kapp says.
- The lesson is don't give up, don't quit.
- ... the take-home lesson is get enough sleep.
- The lesson is, respond quickly.
- Oslo's lesson is, don't give a state to terror.
- After Andrew, the lesson was, build your houses better to withstand high winds.
- And, you know, maybe the lesson is also don't read other people's e-mails.
- Well, I think the obvious lesson is don't take things that aren't yours.
- Thus was the lesson passed on from one generation to another, and the lesson was: You do not tolerate homosexuality. [yikes! -snailboat]
- My third and last lesson is: Don't worry too much about being "wrong."
- The second lesson is: Think twice before you assume people will lay out a lot of money for something they can already see for free.
And as mentioned above, I found a zillion results on Google:
- The lesson was never use clichés, and if you do – never get them wrong because everyone knows you've made a mistake.
- And so the lesson was, never give your customer a product reason to switch away from your brand.
- If there's one lesson that we learned from the 1983 movie
"War Games", the lesson was never disguise your launch codes as games like
chess and checkers where unwitting hackers might bump into them and
accidentally start global thermonuclear war.
- The lesson was, never act in haste.
- But the lesson was "never let a fiscal crisis go to waste".
- The lesson is, never try.
- I guess the lesson is: Never turn your back on Walter White.
And so on. As you can see, there's a lot of variation in how people write this construction down, but regardless of how you write it, it's common enough in standard English that it can't be called "wrong". You can feel free to drop to from the sentence:
The first lesson I learnt as a soldier was never to underestimate the enemy.
The first lesson I learnt as a soldier was never underestimate the enemy.
These sentences mean the same thing, even though their grammar is somewhat different.